As I said before, it could be done, the main requirement is to find a way for pg to check for a value of the system load; of course it has to be an average value between disk and cpu, of course the daemon would have to collect sample of this values continuously, and of course everything would be better if the server it's only running PostgresTrue, but autovacuum could check load -before- and -during- it's execution and it could adjust himself automatically to perform more or less aggressively depending on the difference between those two values. Maybe with a parameter like: maximum-autovacuum-load=0.2 that would mean: "never load the machine more than 20% for the autovacuum"This is pretty non-trivial. How do you define 20% load? 20% of the CPU? Does that mean that it's OK for autovac to use 3% cpu and 100% of your IO? Ok, so we need to calculate an average of IO and CPU -- which disks? If your WAL logs are on one disk, and you've used tablespaces to spread the rest of your DB across different partitions, it can be pretty difficult to determine which IO parameters you want to take into consideration. Still I think you are right, it wouldn't suit exactly every situations but it could be an "emergency" feature: What happened to me was very clear: server running pg8 under heavy load, cpu's were 90% idle as usual. At some point the vacuum started, the server reached 50 of overall load and cpu's were 1% idle I think any test can detect such a situation, regardles if load it's more I/O based or CPU based |