<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Vacuum Postgres nightly</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="home" href="index.html" title="OpenACS Core Documentation"><link rel="up" href="database-management.html" title="Chapter�7.�Database Management"><link rel="previous" href="install-openacs-delete-tablespace.html" title="Deleting a tablespace"><link rel="next" href="backup-recovery.html" title="Chapter�8.�Backup and Recovery"><link rel="stylesheet" href="openacs.css" type="text/css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><a href="http://openacs.org"><img src="/doc/images/alex.jpg" border="0" alt="Alex logo"></a><table width="100%" summary="Navigation header" border="0"><tr><td width="20%" align="left"><a accesskey="p" href="install-openacs-delete-tablespace.html">Prev</a> </td><th width="60%" align="center">Chapter�7.�Database Management</th><td width="20%" align="right"> <a accesskey="n" href="backup-recovery.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="install-next-nightly-vacuum"></a>Vacuum Postgres nightly</h2></div></div></div><p>
      The "vacuum" command must be run periodically to reclaim space
      in versions of PostgreSQL before 7.4. The "vacuum analyze" form
      additionally collects statistics on the 
      disbursion of columns in the database, which the optimizer uses when
      it calculates just how to execute queries. The availability of this
      data can make a tremendous difference in the execution speed of
      queries. This command can also be run from cron, but it probably makes
      more sense to run this command as part of your nightly backup
      procedure - if "vacuum" is going to screw up the database, you'd
      prefer it to happen immediately after (not before!) you've made a
      backup! The "vacuum" command is very reliable, but conservatism is
      the key to good system management. So, if you're using the export
      procedure described above, you don't need to do this extra
      step.
    </p><p>Edit your crontab:</p><pre class="programlisting">[joeuser ~]$ <b class="userinput"><tt>crontab -e</tt></b></pre><p>We'll set vacuum up to run nightly at 1 AM. Add the following
    line:</p><pre class="programlisting">
0 1 * * * /usr/local/pgsql/bin/vacuumdb <span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span></pre><div class="cvstag">($Id: install-next-nightly-vacuum.html,v 1.5.2.5 2004/11/01 23:39:48 joel Exp $)</div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="install-openacs-delete-tablespace.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="backup-recovery.html">Next</a></td></tr><tr><td width="40%" align="left">Deleting a tablespace </td><td width="20%" align="center"><a accesskey="u" href="database-management.html">Up</a></td><td width="40%" align="right"> Chapter�8.�Backup and Recovery</td></tr></table><hr><address><a href="mailto:docs@openacs.org">docs@openacs.org</a></address></div><a name="comments"></a><center><a href="http://openacs.org/doc/current/install-next-nightly-vacuum.html#comments">View comments on this page at openacs.org</a></center></body></html>