mysql_pconnect / persistent database conections
| From: | Ben Edwards | Date: | Thu, 27 Jan 2005 17:02:32 +0000 |
| Subject: | mysql_pconnect / persistent database conections | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-207512@lists.php.net to get a copy of this message | ||
Been meaning to investigate persistent database connections for a
while. Coming from a rdbms background (oracle with a bit of whatcom
sqlanywhare) I have always felt that the overhead of opening a
connection at the beginning of each page was a little resource
intensive.
Anyway, I found mysql_pconnect and this sounds like just the ticket.
Seems that I can just change my connect method from mysql_connect to
mysql_pconnect and it will just work.
I do have a couple of questions. Firstly what is the story with
mysql_close. There is no mysql_pclose. I guess you don't need to
close the connection at the end of each page but what if you do. Is
mysql_close ignored if the connection was made with mysql_pconnect or
douse it close the connection and next time mysql_pconnect is run it
reconnects causing no benefit over mysql_pconnect. also what is the
timeout likely to be?
My other question is what happens if lots of people connect using the
same user/password. I tend to do my own user management so everybody
douse. Is doing my own user management really dodge, if we were
talking about oracle I would probably say it is.
Ben
--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)