On Apr 4, 2005, at 12:40 PM, Rodolfo J. Paiz wrote:
> I've just noticed that there is a disconnect function in PEAR's DB
> module. For web pages (written in PHP) that connect to PostgreSQL,
> should I *always* disconnect when finished with that page's queries? Or
> is it pretty much optional, or only used in high-traffic situations
> where resource exhaustion is a concern?
I would say optional. The command is there if you need it (suppose you
have a long running script or open a lot of different connections), but
the connections are automatically released at the end of the script.
For scripts with a web page view type lifetime, I don't see the need to
worry about it. Here is what the php docs say about pg_close:
Note: Using pg_close() is not usually necessary, as non-persistent
open connections are automatically closed at the end of the script.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL