0

I'm using Postgres version 9.6

Most of my tables are for queries, update, insert.

Most of them around 200K-700K.

There are bigger (millions) and smaller.

Is that a good idea to perform vacuum (and analyze?) operation once a day? once a week? regardless if there is an autovacuum.. Advantages vs disadvantages?

user2671057
  • 1,411
  • 2
  • 25
  • 43

1 Answers1

0

Autovacuum is done when needed and it only creates statistics that are used when planning a query.

Basically you never need to do this manually, unless you have made vast changes to a table (filled it with data for example), and want to use it in another query within a few milliseconds. In that scenario, old statistics will result in the query planner coming up with a very bad query plan and will lead to a significantly slower query.

What you might want to do once per day / per week, or whatever, is to cluster tables, recreate degraded indexes, on tables that were modified a lot. Research these topics more to decide if / when / how to do it.

Alex
  • 14,338
  • 5
  • 41
  • 59