Monitor pg_xlog size via SQL with postgres 9.4

Поиск
Список
Период
Сортировка
От Sylvain Marechal
Тема Monitor pg_xlog size via SQL with postgres 9.4
Дата
Msg-id CAJu=pHRQUCcw2UEwZa6-guem2NmH=coav+XyTu8wMTd2sRZMBQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Monitor pg_xlog size via SQL with postgres 9.4  (Jehan-Guillaume de Rorthais <ioguix@free.fr>)
Re: Monitor pg_xlog size via SQL with postgres 9.4  (Francisco Olarte <folarte@peoplecall.com>)
Re: Monitor pg_xlog size via SQL with postgres 9.4  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-general
Hello all,

is there a way to monitor the size of the pg_xlog directory in SQL? The goal is to monitor the pg_xlog file without ressorting to a 'du' like solution that needs a direct access to the machine.

I know I can get the retained size for existing replication slots segment in case there are some with the following query :
<<<
SELECT slot_name, database, active, pg_xlog_location_diff(pg_current_xlog_insert_location(), restart_lsn) AS retained_bytes FROM pg_replication_slots  ;
>>>

but how could I monitor the real size of the pg_xlog directory and detect it is growing (may be because the archive_command is becomed faulty)

I was thinking of using the last_archived_wal field of the pg_stat_archiver table, but I am not sure it is accurate, and I do not find any postgres stored procedure that converts the file name into an LSN (ie, a function that does the opposite of pg_xlogfile_name())

Thanks and regards,
Sylvain

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unstable C Function
Следующее
От: Jehan-Guillaume de Rorthais
Дата:
Сообщение: Re: Monitor pg_xlog size via SQL with postgres 9.4