Improve `PostReceive` performance by using replica
Problem
As suggested here, we currently use data_consistency: always for PostReceive worker. It means that we send all queries to the primary DB.
PostReceive is used a lot. We call it for each git push event. That puts a pressure on the database.
Proposal
Redirect some of queries generated by PostReceive to replicas if possible.
Would it be possible to explicitly wrap the
SELECTqueries in aSession#use_replicas_for_read_queriesinstead of using the wait mechanism?