we've been using postgres 8.3 on linux in a production environment for over 2 years now, and this morning the database choked on a daily run query, which it used to execute without any problem.

The difference this morning was that an index which should be used, was not, instead a sequential read was executed, killing performance.

To solve the problem, I think I VACUUMed the table first (with option ANALYZE checked), which improved things a bit: an index was being used, but not the one I had expected. I've then had to REINDEX the index I wanted to be used (I can't remember whether I used RECREATE or not), after which the query executed like it used to.

Now my question is: why did I have to do this explicitly? I thought the autovacuum-process handled vacuuming and analyzing of tables and indexes automatically?