title: How to deal with a stuck PostgreSQL 9.3 VACUUM ANALYZE?
body: <p>We run PostgreSQL 9.3 on the AWS RDS platform. Every night at 1am we've been running a global <code>VACUUM ANALYZE</code> job.</p>
  
  <p>Yesterday we observed severe degradation in performance and as it turned out we had 5 <code>VACUUM ANALYZE</code> processes stuck for the past 5 days. Over the same period of time the disk utilization went up by 45 gigabytes.</p>
  
  <p>I killed it with <code>pg_terminate_backend</code> but that didn't have much impact. The processes looked dead but performance was still severely degraded. Since we are using AWS RDS, we've performed a reboot with failover and performance drastically improved right away. </p>
  
  <p>This morning I checked and found that <code>VACUUM ANALYZE</code> was stuck again for 5 hours. I killed it, but I suspect it is still there somewhere. </p>
  
  <p>Upon further investigation I confirmed that <code>auto_vacuum</code> is correctly enabled, which means we do not need to run manual <code>VACUUM</code> but we may need to run <code>ANALYZE</code> on some or all of the tables.</p>
  
  <p>In my research I found this article: <a href="http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html" rel="nofollow">http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html</a> and <a href="http://wiki.postgresql.org/wiki/Introduction_to_VACUUM,_ANALYZE,_EXPLAIN,_and_COUNT" rel="nofollow">http://wiki.postgresql.org/wiki/Introduction_to_VACUUM,_ANALYZE,_EXPLAIN,_and_COUNT</a> . </p>
  
  <p>In the end, I have the following questions:</p>
  
  <ol>
  <li>Is it correct to not run manual VACUUM with auto_vacuum enabled ?</li>
  <li>How can I monitor the progress and performance of auto_vacuum ? How do I know it is not stuck in the same place as the manual VACUUM ?</li>
  <li>Do I still need run ANALYZE on a regular basis ?</li>
  <li>Is there a way to enable automatic ANALYZE, similar to auto_vacuum ?</li>
  </ol>