Disk usage

Started by Daniel Lublinalmost 23 years ago7 messagesgeneral
Jump to latest
#1Daniel Lublin
lists@lublin.nu

Good day.

I am wondering if there is some utility for postgresql, which can
display the amount of disk space that a database (and possibly even
more finer grained; a table) occupies?

I could probably examine $PGDATA/base, but then I'd first have to
figure out how things are stored in there. So assumed there already
would be some utility that does this.

//Daniel

#2Shridhar Daithankar
shridhar_daithankar@persistent.co.in
In reply to: Daniel Lublin (#1)
Re: Disk usage

On 8 May 2003 at 12:41, Daniel Lublin wrote:

Good day.

I am wondering if there is some utility for postgresql, which can
display the amount of disk space that a database (and possibly even
more finer grained; a table) occupies?

du in $PGDATA coupled with oid2name to figure out what is the object you are
lookng at.

HTH

Bye
Shridhar

--
Famous last words: (1) "Don't worry, I can handle it." (2) "You and what army?"
(3) "If you were as smart as you think you are, you wouldn't be a cop."

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Shridhar Daithankar (#2)
Re: Disk usage

"Shridhar Daithankar" <shridhar_daithankar@persistent.co.in> writes:

On 8 May 2003 at 12:41, Daniel Lublin wrote:

I am wondering if there is some utility for postgresql, which can
display the amount of disk space that a database (and possibly even
more finer grained; a table) occupies?

du in $PGDATA coupled with oid2name to figure out what is the object you are
lookng at.

Or do

vacuum;
select relname, relpages * 8 from pg_class;

to get table sizes in kilobytes. relpages is not updated on-the-fly,
only by vacuum, so you need to have done vacuum recently to get
trustworthy numbers.

regards, tom lane

#4Jay O'Connor
joconnor@cybermesa.com
In reply to: Shridhar Daithankar (#2)
Re: Disk usage

On 2003.05.08 04:12 Shridhar Daithankar wrote:

On 8 May 2003 at 12:41, Daniel Lublin wrote:

Good day.

I am wondering if there is some utility for postgresql, which can
display the amount of disk space that a database (and possibly even
more finer grained; a table) occupies?

du in $PGDATA coupled with oid2name to figure out what is the object you
are
lookng at.

HTH

Thanks, I found that helpful.

One question though is about the transaction log files on the px_log
directory I have two huge files totalling about 30 meg. One thing I'm
working on is figuring out how much disk usage I'll have for our data
compared to what we are using now. I'm wondering if I should count those
two files and if there is a way of eliminating them if they ever become not
needed

Thanks

Take care,
Jay

#5scott.marlowe
scott.marlowe@ihs.com
In reply to: Jay O'Connor (#4)
Re: Disk usage

On Thu, 8 May 2003, Jay O'Connor wrote:

On 2003.05.08 04:12 Shridhar Daithankar wrote:

On 8 May 2003 at 12:41, Daniel Lublin wrote:

Good day.

I am wondering if there is some utility for postgresql, which can
display the amount of disk space that a database (and possibly even
more finer grained; a table) occupies?

du in $PGDATA coupled with oid2name to figure out what is the object you
are
lookng at.

HTH

Thanks, I found that helpful.

One question though is about the transaction log files on the px_log
directory I have two huge files totalling about 30 meg. One thing I'm
working on is figuring out how much disk usage I'll have for our data
compared to what we are using now. I'm wondering if I should count those
two files and if there is a way of eliminating them if they ever become not
needed

That's the write ahead logging system. It isn't optional, so it won't
ever not be needed. But, you can change how big they are by playing with
the WAL settings in the $PGDATA/postgresql.conf file.

http://www.postgresql.org/docs/view.php?version=7.3&amp;idoc=0&amp;file=runtime-config.html#RUNTIME-CONFIG-WAL

#6Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Tom Lane (#3)
Re: Disk usage

On Thu, May 08, 2003 at 10:39:48AM -0400, Tom Lane wrote:

Or do

vacuum;
select relname, relpages * 8 from pg_class;

to get table sizes in kilobytes. relpages is not updated on-the-fly,
only by vacuum, so you need to have done vacuum recently to get
trustworthy numbers.

Doesn't ANALYZE update relpages values?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"God is real, unless declared as int"

#7Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#6)
Re: Disk usage

Alvaro Herrera wrote:

On Thu, May 08, 2003 at 10:39:48AM -0400, Tom Lane wrote:

Or do

vacuum;
select relname, relpages * 8 from pg_class;

to get table sizes in kilobytes. relpages is not updated on-the-fly,
only by vacuum, so you need to have done vacuum recently to get
trustworthy numbers.

Doesn't ANALYZE update relpages values?

Yes, vacuum and analyze do it. There is a 'monitoring disk space'
section in the 7.3 docs too.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073