ANALYZE
and VACCUM
Postgres needs to analyze and vacuum regularly for optimal performance.
Postgres can do it automatically for you. Make sure the autovacuum_analyze_scale_factor
and autovacuum_vacuum_scale_factor
are set to a sensible value. We recommend 0.1
by default,
but it depends on the size of your tables.
events
, invoices
, charges
and fees
.
Configure custom override values for these tables.
For example, the events
table should use a value lower than 0.01
.
Because this factor is a ratio, it’s expected to lower it from time to time as your table size grows.
The most important table to monitor is
events
. Depending on your implementation, this table can receive big
burst of data and should be analyzed and vacuumed often.When to run manually
If you send events in batch, it’s recommended to analyze and vacuum yourevents
table after the batch is ingested: