Skip to content

Database Vaccum & Re index Cron Job

Sriram Viswanathan edited this page Jun 4, 2023 · 1 revision

We have a cron-job doing vaccum and re-indexing of the postgres database with following configuration -

# Vacuum database at midnight every Sunday
0 0 * * SUN vacuumdb --dbname=pp --host=localhost --username=app --quiet
0 0 * * SUN touch /data/last_pp_db_vacuumed

# Re-index 'pp' database weekly once every Sunday at 01:00 - after vacuum finishes
0 1 * * SUN reindexdb --dbname=pp --host=localhost --username=app --quiet
0 1 * * SUN touch /data/last_pp_db_reindexed