Re: [NOVICE] General Performance questions

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Delao, Darryl W" <ddelao(at)ou(dot)edu>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [NOVICE] General Performance questions
Date: 2003-03-10 16:16:21
Message-ID: 20030310161621.22ED1103C2@polaris.pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2003-03-10 16:28:54 where is comments located?
Previous Message Dwayne Miller 2003-03-10 16:00:22 Determining if table exists before dropping

Browse pgsql-novice by date

  From Date Subject
Next Message Joe Conway 2003-03-10 16:46:25 Re: Value of sequence last inserted
Previous Message Tom Lane 2003-03-10 15:45:26 Re: [NOVICE] General Performance questions