Re: Postgres PHP error - Mailing list pgsql-general

From Steve Crawford
Subject Re: Postgres PHP error
Date
Msg-id 50BCFAAA.7090604@pinpointresearch.com
Whole thread Raw
In response to Postgres PHP error  (rahul143 <rk204885@gmail.com>)
List pgsql-general
On 12/02/2012 09:18 PM, rahul143 wrote:
> Hi All
>
> Im receiving the following error, on a php page, conneting to postgres 7.4,
> installed on Mandrake 10.0
> <snip>
> Error Description: pg_connect(): Unable to connect to PostgreSQL server:
> FATAL: sorry, too many clients already .
> </snip>
> Can anyone tell me what this means?
> Is there a performance setting I need to set under the postgresql conf file.
> I have checked, and its set to 100 users.
> This error strangely has only happened once. Last week Monday.
>
It means you had 100 clients connected to your PostgreSQL server which
was set to a max of 100 clients thus all new attempts failed. It's not
strange at all to see this only intermittently - it merely requires
something that delays the processing of requests from your web-app. An
easy example is a query that locks a critical table long enough for 100
connections from the web app to build up. Or your database server could
have been briefly too busy to handle the incoming queries fast enough.

Don't just increase the max clients setting. You need to diagnose the
cause (maintenance query that shouldn't have been run during heavy use
periods, inadequate hardware, app failing to close connections properly
or quickly enough, bad database tuning, etc.) before prescribing a cure
(procedure change, new hardware, better tuning, connection pooling,
query caching, etc.).

Cheers,
Steve



pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: function
Next
From: Richard Huxton
Date:
Subject: Re: Postgres PHP error