Search Postgresql Archives

Re: How to tell how much of the database is being used for data.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux