Re: [HACKERS] database size

Bruce Momjian <maillist@candle.pha.pa.us>

From: Bruce Momjian <maillist@candle.pha.pa.us>
To: tonester@ccom.net (Tony Rios)
Cc: sthomas@cise.ufl.edu, pgsql-hackers@postgreSQL.org
Date: 1998-01-07T01:16:34Z
Lists: pgsql-hackers
> Just wondering.. did you happen to do an INSERT into the database,
> 
> then delete some rows.. say 19megs worth, then re-add...  From what I've
> 
> seen msql db's will always be at least the size of the largest you've ever
> 
> had the database before.  It will over time, overrite existing deleted
> 
> records, but it keeps the data still in there, just sets a delete flag.
> 
> 
> If you really need to cut the size down, I've had to delete the database
> 
> completely, then create another table from scratch.  Not sure if there
> 
> is a 'purge' type function available, but you have to be careful that
> 
> nobody is accessing the db at that time, since it's very sensitive at
> 
> that time.
> 

Thanks to Vadim, vacuum shrinks the size to the exact amount needed to
store the data.  Also, the table is locked while vacuuming, so no one
can accidentally access it.

-- 
Bruce Momjian
maillist@candle.pha.pa.us