Re: Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?
| From: | Mailing Lists) | Date: | Thu, 10 Dec 2009 19:22:32 +0000 |
| Subject: | Re: Combing PDO with mysql_pconnect connections in one application -- will this degrade performance? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46680@lists.php.net to get a copy of this message | ||
>
> One thing to be careful is if you are relying on 'transactions' to handle anything.
> Obviously the transaction has to be in the same connection just to work. Despite what others have
> said, the PDO connection will be different to the generic mysql connection as it is a separate
> process. Persistent connections will only reuse an already open connection, you can't connect
> two processes to the same connection. You would not know which process was accessing things.
According to the documentation:
"First, when connecting, the function would first try to find a (persistent) link that's
already open with the same host, username and password. If one is found, an identifier for it will
be returned instead of opening a new connection."
Therefore, providing you've configured PHP's --with-mysql and --with-pdo-mysql options
with the same MySQL library, then as long as the host, username and password are the same, the same
connection will be re-used for both the native (mysql_pconnect) connection and the PDO connection.
I'm not sure about the mysqli library, but I believe that lies beneath the mysql_* family of
functions anyway so it shouldn't make a difference whether you're using libmysqlclient or
mysqli.
Regards,
Andy