Re: Disconnect - required, recommended, or optional?

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "Rodolfo J(dot) Paiz" <rpaiz(at)simpaticus(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Disconnect - required, recommended, or optional?
Date: 2005-04-04 18:19:47
Message-ID: 20633C46-A536-11D9-8FA8-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Morgan Kita 2005-04-04 20:15:37 Re: Major problem with custom data type
Previous Message Richmond Dyes 2005-04-04 17:34:10 I am verynew to postgresql problem with defining blob field