Re: Execute VACUUM FULL when DB touches a specific size ?

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: Execute VACUUM FULL when DB touches a specific size ?
Дата
Msg-id 4BB9833B.3080005@lelarge.info
обсуждение исходный текст
Ответ на Re: Execute VACUUM FULL when DB touches a specific size ?  (Nilesh Govindarajan <lists@itech7.com>)
Список pgsql-admin
Le 05/04/2010 06:08, Nilesh Govindarajan a écrit :
> On 04/05/10 08:54, Scott Marlowe wrote:
>> On Sun, Apr 4, 2010 at 8:21 PM, Nilesh Govindarajan<lists@itech7.com>
>> wrote:
>>> Hi,
>>>
>>> I wish to execute VACUUM FULL when DB touches a specific size. How to
>>> do it
>>> ?
>>>
>>> I'm aware about the caveats of VACUUM FULL.
>>>
>>
>> Write a bash script that cds to the data dir and runs du -s, grabs the
>> value, and if it's over a certain size then run vacuum full.
>
> That's what I was thinking to do, but how do I distinguish between the
> databases ? The datadir/base seems have directories whose names are
> numbers.
>

You can find the number with a simple query (SELECT oid FROM pg_database
WHERE datname='your database name') or with the oid2name contrib module.

But that's not the real issue. If you have objects of this database in
other tablespaces, "du -sh" on datadir/base/<oid> won't count them. You
should better use this query:

  SELECT pg_database_size('your database name')

to get the total size of your database.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

В списке pgsql-admin по дате отправления:

Предыдущее
От: Vibhor Kumar
Дата:
Сообщение: Re: Execute VACUUM FULL when DB touches a specific size ?
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: Backup from a hot standby