Ensure that the builds queuing query is executed on replicas [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
This merge request adds code that ensures that the big builds queuing query gets executed on database replicas, instead of the primary database, when database load balancing is enabled.
It also adds additional instrumentation to makes it easier to understand how long it actually takes to retrieve results from the database.
Conformity
Issues
See #324659 (closed)
Edited by Grzegorz Bizon