Pedro Alves wrote:
>
> Hi. Is there any way to put a vacuum and a vacuum analyze (the
> second does everything the first does? Or do I need to use both?) in a cron
> so that it is executed nightly?
Use a crontab entry like:
0 3 * * * /usr/local/bin/psql -d <database> < /.../vacuum_analyze
make sure the crontab owner has permission to do a vacuum analyze.
Change the path of psql as appropriate.
And finally the file /.../vacuum_analyze should contain:
vacuum analyze \g
\q