Re: [HACKERS] database size - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] database size
Date
Msg-id 199801070116.UAA06828@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] database size  (Tony Rios <tonester@ccom.net>)
List 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

pgsql-hackers by date:

Previous
From: Shiby Thomas
Date:
Subject: Re: [HACKERS] database size
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] database size