Mysql pconnect
Mysql_connect Vs Mysql_pconnect
There are two different connections available, if you are connecting to a MySQL database in your PHP application, mysql_connect – which set up a new connection “each time” and mysql_pconnect which uses persistent connections.
Mysql_connect opens a new connection each time a PHP page is called, and closes the connection down again at the end of the request. It is perfect for pages that do not have a heavy usage.
Mysql_pconnect will also open a new connection when a PHP page is called, but it will NOT close the connection at the end of the request – instead, it will put aside it in a connection pool so that a succeeding request can persist to use the same connection. It’s intended for pages that have a heavy usage – where the resources burn up by opening and closing connections every time might reduce performance.
But mysql_pconnect need some tuning of the servers and you may require limiting the numbers of connections / children and configuring timeouts and how to deal with idle children.
By using this you have some drawbacks as follows.
It does NOT give you sessions.
It does NOT give you a per-site-visitor login.
It does NOT give you any added functionality.