Re: [NOVICE] General Performance questions - Mailing list pgsql-general

From Steve Crawford
Subject Re: [NOVICE] General Performance questions
Date
Msg-id 20030310161621.22ED1103C2@polaris.pinpointresearch.com
Whole thread Raw
In response to General Performance questions  ("Delao, Darryl W" <ddelao@ou.edu>)
List pgsql-general
> I will have anywhere from 5 to 7 of these going at any given time.  However
> most say TIME_WAIT instead of established.
> I am assuming these are connections to the database that php is using to
> post and retrieve data.

No, those connections have been closed. TIME_WAIT is part of the TCP spec.
After a connection is closed the port will stay in a "TIME_WAIT" state for a
short time. This is a defensive mechanism that prevents that port from being
opened before enough time has elapsed to allow any stray delayed packets from
the old connection to be dealt with. Without this delay another connection
could be opened instantly and could incorrectly get a packet left over from
the old connection.

The only "live" connections are those listed as ESTABLISHED.

You didn't mention what version of pg you are using but if it is a recent
version try:
select * from pg_stat_database;
and look at the number of backends which you can get on a database by
database level.

You could get total connections with:
select sum(numbackends) from pg_stat_database;

While you are there check out all the other stuff you can see in the pg_stat*
tables.

Cheers,
Steve

pgsql-general by date:

Previous
From: "Dwayne Miller"
Date:
Subject: Determining if table exists before dropping
Next
From: "Johnson, Shaunn"
Date:
Subject: where is comments located?