I am setting up a database class in my php application, and I was planning on using either PDO or MySQLi.
I was thinking of persistant connections, but I am wondering if this is the best idea. I saw, unlike PDO, MySQLi automaticly resets the state of the connection with mysqli_change_user()
.
However, as noted in the PHP manual, it states that the mysqli_change_user()
function is expensive and could degrade performance, but that you can also disable it.
I currently have two questions:
- Are persistant connections a good idea? And if so, with PDO or MySQLi?
- Is the
mysqli_change_user()
function so expensive that it nullifies the performance increase of using a persistant connection? If so, is it such a bad idea to disable it, if you have written proper code?