title: When should one vacuum a database, and when analyze?
body: <p>I just want to check that my understanding of these two things is correct. If it's relevant, I am using Postgres 9.4. </p>
  
  <p>I believe that one should <strong>vacuum</strong> a database when looking to reclaim space from the filesystem, e.g. periodically after deleting tables or large numbers of rows. </p>
  
  <p>I believe that one should <strong>analyse</strong> a database after creating new indexes, or (periodically) after adding or deleting large numbers of rows from a table, so that the query planner can make good calls. </p>
  
  <p>Does that sound right?</p>