check_last_maintenance : filter out small tables#426
Conversation
What is the purpose of the `last_vacuum` and `last_analyze` probes? * To be alerted when statistics are reset following a crash, a failover, etc. * To detect large tables that are no longer being processed frequently enough due to the default autovacuum settings, which are not always well-suited for large tables. Alerts for small tables therefore constitute unnecessary noise.
| This service supports a "--analyze_table_min_size" parameter to | ||
| exclude small relations. The value must be a positive integer | ||
| representing the threshold in kilobytes below which the relation | ||
| is excluded. This defaults to 1024 (1MB). |
There was a problem hiding this comment.
We should specify that we are talking about the "main fork" and maybe reflect
this in the parameter name.
There was a problem hiding this comment.
I would expect units to work here.
I don't know if that's necessary, we will likely filter small table so the value should be easy to
read whthout it. But it would be consistent with other sizes.
There was a problem hiding this comment.
main fork only? toast not included?
There was a problem hiding this comment.
main fork only? toast not included?
Yes because the toast table is processed separately by autovacuum. The main fork could be only 8kB, 100 tuples, never vacuumed, while the toast table can be 100MB, 50000 tuples, already vacuumed. If you use pg_table_size instead of pg_relation_size, you will get an alert for the main fork, and we don't want that.
| This service supports a "--vacuum_table_min_size" parameter to | ||
| exclude small relations. The value must be a positive integer | ||
| representing the threshold in kilobytes below which the relation | ||
| is excluded. This defaults to 10240 (10MB). |
There was a problem hiding this comment.
same as --analyze_table_min_size
| This service supports a "--analyze_table_min_size" parameter to | ||
| exclude small relations. The value must be a positive integer | ||
| representing the threshold in kilobytes below which the relation | ||
| is excluded. This defaults to 1024 (1MB). |
There was a problem hiding this comment.
main fork only? toast not included?
| 'wal_buffers' => undef, | ||
| 'checkpoint_segments' => undef, | ||
| 'effective_cache_size' => undef, | ||
| 'vacuum_table_min_size' => 10 * 1024, |
There was a problem hiding this comment.
10 MB is already too much I think.
Most small tables that gives false alarms are only a few blocks wide.
We can discuss at length the right limit, but since we had service that was much too sensitive, perhaps shall we raise the bar not so high.
There was a problem hiding this comment.
I think 1000 tuples would be a better threshold (autovacuum_vacuum_insert_threshold default value).
A 2MB table should contains at least that number of tuples.
What is the purpose of the
last_vacuumandlast_analyzeprobes?Alerts for small tables therefore constitute unnecessary noise.