Re: Postgres PHP error

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: rahul143 <rk204885(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres PHP error
Date: 2012-12-03 19:16:58
Message-ID: 50BCFAAA.7090604@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2012-12-03 20:08:32 Re: Postgres PHP error
Previous Message Raymond O'Donnell 2012-12-03 17:24:42 Re: function