Thread: Postgres PHP error

Postgres PHP error

From
rahul143
Date:
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.

Kind Regards,



-----




--
View this message in context: http://postgresql.1045698.n5.nabble.com/GENERAL-Postgres-PHP-error-tp5734655.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: Postgres PHP error

From
"Albe Laurenz"
Date:
rahul143 wrote:
> 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.

The parameter is max_connections, and it seems that last week Monday
you had exhausted that limit.  You should try to figure out what caused
the problem rather than indiscriminately raising max_connections.

You could turn on log_connections, that would help finding the cause.

I guess I don't have to tell you that you should upgrade.

Yours,
Laurenz Albe


Re: Postgres PHP error

From
Steve Crawford
Date:
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



Re: Postgres PHP error

From
Richard Huxton
Date:
On 03/12/12 05:18, rahul143 wrote:
> Hi All
>
> Im receiving the following error, on a php page, conneting to postgres 7.4,
> installed on Mandrake 10.0
>

Others have answered your question. However...

Please make sure you have regular scheduled backups for that database.
That is quite an old (9 years) version of PostgreSQL and you'll be
unlikely to find many people with a similar version who can help you
with problems in the event of a crash.

It's probably a good idea to see if you can install the latest version
from source on that machine and use it's version of pg_dump to dump the
database regularly too. I'd expect to have to do a little work to move
the data into an up-to-date version of PostgreSQL and it's always better
to know what issues you'll have before doing it for real.

--
   Richard Huxton
   Archonet Ltd


Re: Postgres PHP error

From
Alvaro Herrera
Date:
Richard Huxton escribió:
> On 03/12/12 05:18, rahul143 wrote:
> >Hi All
> >
> >Im receiving the following error, on a php page, conneting to postgres 7.4,
> >installed on Mandrake 10.0
> >
>
> Others have answered your question. However...

As I noted elsewhere, please ignore this guy.  He's a bot re-injecting
very old list email.


--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


Re: Postgres PHP error

From
Michael Paquier
Date:


On Mon, Dec 3, 2012 at 2:18 PM, rahul143 <rk204885@gmail.com> 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?
This error means that the maximum number of clients that can connect at the same time has been reached on server.
 
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.
Increase your maximum number of users.
Then, you can still improve your application by reducing the time they hold connections on server.
--
Michael Paquier
http://michael.otacoo.com