From: | "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> |
---|---|
To: | <pobox(at)verysmall(dot)org>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: use superuser connection from php |
Date: | 2007-04-02 13:39:19 |
Message-ID: | AFCCBB403D7E7A4581E48F20AF3E5DB201FF77CE@EXADV1.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> we have a php application which gets from time to time database errors
> which look like there are not enough connections (we have 100
> connections allowed to postgresql) -
>
> i read that there are two db connections reserved for su. is there a
way
> to use them from php in order to check if the database is really out
of
> connections (with - 'SELECT count(*) FROM pg_stat_activity') or the
> problem is different?
You can connect as superuser on a different connection and issue that
SELECT statement.
But I wouldn't do that. What if there is a problem and all availaible
superuser connections are exhausted? You would not be able to connect
to the database any more, even as superuser.
I would rather examine the SQLSTATE you get from the failed connection
attempt. PostgreSQL returns SQLSTATE 53300 (TOO MANY CONNECTIONS) when
the
maximum os reached. This way you can distinguish that case from others.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Teodor Sigaev | 2007-04-02 13:45:55 | Re: to_tsvector in 8.2.3 |
Previous Message | richardcraig | 2007-04-02 13:25:49 | Re: to_tsvector in 8.2.3 |