pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
To: Joshua D. Drake <jd@commandprompt.com>
Cc: Ziegelwanger, Silvio <Silvio.Ziegelwanger@fabasoft.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Monitoring Transaction Log size
Date: Wed, 17 Jan 2007 19:29:09 +0100
Message-ID: <45AE6AF5.4080306@kaltenbrunner.cc> (raw)
In-Reply-To: <45AE6376.7060606@commandprompt.com>
References: <B710F3299F04664DB6B37C258FDEEB9402A617@FABAMAIL.fabagl.fabasoft.com>
	<45AE6376.7060606@commandprompt.com>

Joshua D. Drake wrote:
> Ziegelwanger, Silvio wrote:
>> Hi,
>>
>>  
>>
>> how can I monitor the size of the transaction log files using SQL Statements?
> 
> You can't. You would have to write a custom function to heck the size of
> the xlog directory.

wel in recent versions of pg it should be pretty easy to do that from
within SQL by using pg_ls_dir() and pg_stat_file().

maybe something(rough sketch) along the line of:

select sum((pg_stat_file('pg_xlog/' || file)).size) from
pg_ls_dir('pg_xlog') as file where file ~ '^[0-9A-F]';

might do the trick


Stefan



view thread (7+ messages)  latest in thread

Message-ID: <45AE6AF5.4080306@kaltenbrunner.cc>
Permalink:  ../45AE6AF5.4080306@kaltenbrunner.cc/
Also on:    postgresql.org/message-id/45AE6AF5.4080306@kaltenbrunner.cc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: stefan@kaltenbrunner.cc, jd@commandprompt.com, Silvio.Ziegelwanger@fabasoft.com
  Subject: Re: Monitoring Transaction Log size
  In-Reply-To: <45AE6AF5.4080306@kaltenbrunner.cc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox