Re: Autovacuum script

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

 



On Thu, 2022-04-07 at 12:36 +0300, Avihai Shoham wrote:
> I would like for you advice/sharing  about a python script that will run overnight and do autovacuum.
>  
> I'm sharing mine below and will happy if you have suggestion to improve it , or sharing yours in case you have.
> I'm not an expert of python or postgrsql so please understand :)
> 
> The script below do autovacuum for the biggest 10 tables
> -----------------------------------------------------------------------------------------------------------------------------------
> #!/usr/bin/python
> [...]
>           query = 'VACUUM FULL %s;' % (row[0])

I think that is quite a bad idea, for several reasons:

1. VACUUM (FULL) blocks read access to the table and is *not* a routine maintenance job
   It should be VACUUM instead.

2. It may not be your largest tables that require VACUUM

3. There already is an autovacuum daemon in PostgreSQL that takes care of that and
   has many parameters to adapt it to your needs.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux