vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hello, 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? thanks, iv ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| On Mon, Apr 02, 2007 at 11:33:50AM +0200, pobox@verysmall.org wrote: > 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? To use the superuser connections you need to login as superuser... Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFGEN8MIB7bNG8LQkwRAr4tAJ9lwYwGHVe8jKZBnChtBo 0f6dBWkgCdHYV3 ct3Ba3huUFM5z9flOh6Dp/4= =QSLr -----END PGP SIGNATURE----- |
| |||
| > 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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| |||
| Martijn van Oosterhout wrote: > To use the superuser connections you need to login as superuser... Eh... OK. I feel a bit stupid Iv ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| ||||
| Albe Laurenz wrote: > You can connect as superuser on a different connection and issue that > SELECT statement. OK > 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. True. > 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. Oh, thanks a lot for the hint! Iv ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |