autovacuum: recheck logic
| От | Alvaro Herrera |
|---|---|
| Тема | autovacuum: recheck logic |
| Дата | |
| Msg-id | 20070327205816.GA5999@alvh.no-ip.org обсуждение исходный текст |
| Список | pgsql-patches |
Hi, This is the first non-trivial patch to autovacuum multiple workers. This patch that adds the "recheck" logic to autovacuum worker. With this, the worker first builds its table list and then rechecks pgstat before vacuuming each table to verify that no one has vacuumed the table in the meantime, before vacuuming it. In the current autovacuum world this only means that a worker will not vacuum a table that a user has vacuumed manually. As discussed, it will be much more useful as soon as multiple workers are running concurrently. To do this, I separated the task of calculating autovacuum parameters (freeze_min_age, vacuum cost limit and delay, etc) from the autovac equation calculation (freeze_max_age, pg_class.reltuples, etc). We now keep track of three lists at the initial pg_class scan: 1. tables that need vacuum or analyze, per equations 2. tables not in (1) that have toast tables 3. toast tables that need vacuum Then we append those tables in (2) whose toast tables are in (3), to the (1) list. The rest are discarded. So when we need to do the rechecking, we need to process only those tables that actually needed vacuuming. With the previous coding, we would end up rechecking almost all tables every time (to be exact, all tables that have a toast table). The autovacuum parameters are only calculated in the second pass (the rechecking). The first pass only yields boolean parameters. Unless there are objections I'll apply this tomorrow. -- Alvaro Herrera http://www.PlanetPostgreSQL.org "La naturaleza, tan frágil, tan expuesta a la muerte... y tan viva"
Вложения
В списке pgsql-patches по дате отправления: