views:

212

answers:

3

if i have a script which insert a data then exit the script will be opened by 100 user at same time or within 2 mins

actually im doing email tracking

so pconnect is bettwe or connect is better to reduce the resource

i have close when after insert

+1  A: 

mysql_pconnect() drops the open connection into a pool that can be used by any other request to the same process. As such, each worker keeps the connection open until it dies. This can be acceptable if you keep the number of workers low, but as soon as you raise the number of workers then you're better off switching to mysql_connect(). It will take slightly longer per request since the connection has to be made each time, but you will only create as many connections as there are requests, not workers.

Ignacio Vazquez-Abrams
yea, my script is only for request, therefore if i have over 1000 ppl open the script and run it in between 5 mins, it is better use mysql_connect?
A: 

connect uses fewer resources (idle instances of the web server don't need to keep a database connection open), but pconnect is slightly faster (don't have to open a new connection, it's already there).

so if need less resource, better to use connect?since i worry about open many connection
yes that is correct..
A: 

You can also check this page for more info

http://php.net/manual/en/function.mysql-pconnect.php

Napoleon

nepsdotin