Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of andrejhudec:
Current implementation of MasterSlaveConnection is very restrictive. The slave is picked up only when executeQuery is used. If appliacation uses prepare method in queries, every SELECT is done on master and this is bad for performance of master.
This PR changes how and when it picks the slave or master:
Slave if master was never picked before and ONLY if getWrappedConnection, query, prepare, or executeQuery is used and the query begins with SELECT (case insensitive) string.
Master picked when exec, executeUpdate, insert, delete, update, createSavepoint, releaseSavepoint, beginTransaction, rollback, commit is called.
Master picked when query, prepare or executeQuery is called and the query doesn't begin with SELECT (case insensitive) string.
If master was picked once during the lifetime of the connection it will always get picked afterwards.
One slave connection is randomly picked ONCE during a request.
Comment created by @doctrinebot:
A related Github Pull-Request [GH-313] was closed:
Issue was closed with resolution "Won't Fix"