Re: number of connections to postmaster

Поиск
Список
Период
Сортировка
От Hans-Juergen Schoenig
Тема Re: number of connections to postmaster
Дата
Msg-id 3C740778.AC521FFE@cybertec.at
обсуждение исходный текст
Ответ на number of connections to postmaster  ("Percy" <percy_yip@yahoo.com>)
Список pgsql-general
Check out techdocs.postgresql.org and download PL/Sh by Peter Eisentraut. You
can do the job with the help of an embedded Shell script.
As far as I know there is no other (easy way) of retrieving that information.

Try something like that:

CREATE OR REPLACE FUNCTION "backends_number"() RETURNS "text" AS '
#!/bin/sh
expr $(ps ax | egrep -e ''postgres:.*local'' | wc -l) - 1
' LANGUAGE 'plsh';

I have not tested this extensively but it should work.
Note: PL/Sh is not a trusted embedded languages (system calls are allowed) ->
use a separate database for that and don't use your production database
(security!!!!).

    Hans


В списке pgsql-general по дате отправления:

Предыдущее
От: Björn Lundin
Дата:
Сообщение: Re: access database conversion
Следующее
От: Hugo Coolens
Дата:
Сообщение: batch file