pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Crooke <dcrooke@gmail.com>
To: venu madhav <venutaurus539@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Obtaining the exact size of the database.
Date: Sun, 20 Jun 2010 09:22:13 -0500
Message-ID: <AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimgNriCuf2QVmxUbqqiZO73BZ1VFMmaxq20RSKi@mail.gmail.com>
References: <AANLkTimgNriCuf2QVmxUbqqiZO73BZ1VFMmaxq20RSKi@mail.gmail.com>

Hi there

1. PG 8.1.9 is ancient ... you should upgrade.

2. The database gross size on disk is not affected by VACUUM ANALYZE ... all
this does is return space used by deleted row-versions to PG for re-use. The
only way to reduce it and thus return disk space to the OS is to do a VACUUM
FULL, or to delete the entire table.

3. If you can suspend writes for a while, you can pull off an "online"
VACCUM FULL, or copy and delete the table in order to repack it. Check out
the CLUSTER command.

4. If you're trying to figure out the net size of the table, i.e. how much
free space is inside the table files for reuse by PG, then you need the
pg_stat_tuple function ... this is built in to PG 8.4, and a plug-in
activated by a script for PG 8.3, don't know if it exists in 8.1 or not.
Like SELECT COUNT(*) this requires a full table scan.

Cheers
Dave

sent from my Android phone

On Jun 20, 2010 6:18 AM, "venu madhav" <venutaurus539@gmail.com> wrote:

Hi All,
      I am using Postgres 8.1.9 for my application. My application also has
a clean up module which cleans up specified percentage of total database
size at regular intervals. Now the problem is I use *pg_database_size* to
obtain the size of the database. After deleting the records, we run *Vacuum
Analyze* to reorder the indexes. The problem here is even though some
records are cleared, it still shows the original DB Size. Is there any way
to find out the actual DB Size or it would be more useful, if I can get the
size of each table.
     I can't run *Vacuum Full* because the application should be run 24*7
without downtime.

Can someone please help me in solving this.

Please let me know if you need any clarifications.

Thank you,
Venu.

view thread (5+ messages)  latest in thread

Message-ID: <AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com>
Permalink:  ../AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: dcrooke@gmail.com, venutaurus539@gmail.com
  Subject: Re: Obtaining the exact size of the database.
  In-Reply-To: <AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com>
  References: <AANLkTimgNriCuf2QVmxUbqqiZO73BZ1VFMmaxq20RSKi@mail.gmail.com> <AANLkTim_d6FVYuCuXNS4YRTGYyQ7ixPMdfvfc9qM_CT6@mail.gmail.com>

* 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