Select pending builds from `ci_pending_builds` table
Description
This is the next iteration after #329764 (closed).
This iteration is about using the recently introduced table to accelerate queuing. The outcome of the previous iteration was to validate that the new table can receive inserts and deletes in a transaction with status change in ci_builds in a way that this does not make performance noticeably worse.
In this iteration we want to actually use this table.
Proposal
- Update the 
ci_pending_builds_maintainfeature flat to default enabled, - Backfill 
ci_pending_buildstable during a post deployment migration, - Select builds from 
ci_pending, join withci_buildsand other tables, - Enable this mechanism on production using feature flag toggle.
 
Edited  by Grzegorz Bizon