Re: How to tell how much of the database is being used for data. - Mailing list pgsql-general

From Michael Fuhr
Subject Re: How to tell how much of the database is being used for data.
Date
Msg-id 20060227055309.GA39635@winnie.fuhr.org
Whole thread Raw
In response to How to tell how much of the database is being used for data.  ("Steve Oualline" <soualline@stbernard.com>)
List pgsql-general
On Fri, Feb 24, 2006 at 03:04:27PM -0800, Steve Oualline wrote:
> Question: How can I tell how much free space is in the database itself?

contrib/pgstattuple shows dead tuple and free space statistics for
individual tables.  Will that work?

> Background: We want to keep as many records as possible in the
> database as possible.  Currently we fill the database until the disk
> usage reaches 80% then delete and VACUUM FULL the tables.

Are you deleting all records or only some?  If all then TRUNCATE
would be faster than DELETE + VACUUM FULL and it would have the
same space-releasing effect, although it can't be used in all cases
(see the TRUNCATE documentation for more information).

> We'd like to just VACUUM but only VACUUM FULL is sure to
> release disk space to the operating system.   However if we knew
> how much space was free in the database itself, we could judge how
> many new records we could dump into it.

If you intend to insert more data into the tables then what's the
purpose of giving space back to the OS when you're just going to
be allocating it again?  With frequent vacuuming and reasonable FSM
settings you should be able to keep the tables around a certain
size.  Or do you have usage patterns that make that infeasible?
If so, what are they?

What version of PostgreSQL are you running?  How often do you do
regular vacuums?

--
Michael Fuhr

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Wish: remove ancient constructs from Postgres
Next
From: "S.Thanga Prakash"
Date:
Subject: Re: Operator for int8 array