Re: MySQL close connection, what's the purpose?

From: Date: Sun, 02 Apr 2006 01:15:22 +0000
Subject: Re: MySQL close connection, what's the purpose?
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-233074@lists.php.net to get a copy of this message
Time. Opening a db connection is time consuming. There are many levels involved (making the connection, authentication, etc).. Even worse if the connection is over tcp/ip because that overhead comes in on top as well.
Have you timed it? It would be interesting to actually run a script that opens, retrieves, and inserts data -- let's say 50k times. What's the time difference between one open, 50k retrieves/inserts, and one close-- as compared 50k opens retrieve/insert closes? Maybe I'll do that tomorrow.
You see, my habit stems from doing a lot of communication programming
-- it was my experience that you open a communication port (file/channel/port/whatever); establish a link; exchange data; and close it. There's no need to leave it open.
Just because you can close it doesn't mean you have to.
Everyone has their own way. tedd -- -------------------------------------------------------------------------------- http://sperling.com

« previous php.general (#233074) next »