Re: Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?

From: Date: Thu, 10 Dec 2009 17:30:52 +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-46676@lists.php.net to get a copy of this message
Hi Lester, Our application is not using php transactions (e.g., COMMIT, ROLLBACK etc.), so I think we are safe there. Are you saying that even if both the mysql_pconnect and PDO connection are persistent that they will be completely separate? (Havn't had a chance to test this empirically just yet.) Thanks, Sara Lester Caine wrote:
Sara Leavitt wrote:
Hi, We are about to convert all of our queries using mysql_pconnect to prepared statements using PDO database connections. It will take some time to convert the hundreds of SQL statements so the plan is to do it in phases. Is it a bad idea to have both a mysql_pconnect and a PDO connection open for the same application? Will this doubling of our database connections for every page hit degrade performance? Any tips on the best way to transition to PDO/prepared statements with minimal disruption?
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.
-- Sara Leavitt, UC Berkeley Event Calendar Coordinator Public Affairs, University of California 2200 Bancroft Way Berkeley, CA 94720-4204 Phone: 510 643-6163 http://events.berkeley.edu

« previous php.db (#46676) next »