Daily Cron Job to Vacuum Analyze PostgreSQL


(Avi Miller) #1

If you add this to /etc/cron.daily/00-vacuum (or nearest equivalent on your Linux distro), it'll automatically vacuum analyse PostgreSQL each night.

    #!/bin/sh
    
    psql -c "vacuum verbose analyse" -q -S -d  -U 


Remember to set /etc/cron.daily/00-vacuum +x!