How to efficiently vacuum analyze tables in Postgres
<p>I had a huge query running on postgres and one of the join tables always did a sequential scan. There is an index on the constraint column and postgres just didn't use it. I ran a <code>VACUUM ANALYZE</code>, and then the postgres query plan indicates that an index scan is now being used.</p>
<p>My question is, what is the most efficient way to run a <code>VACUUM ANALYZE</code>? Does it lock tables? If so, how do you run <code>VACUUM ANALYZE</code> on live production tables?</p>