Unix Technical Forum

autovacuum: recheck logic

This is a discussion on autovacuum: recheck logic within the Pgsql Patches forums, part of the PostgreSQL category; --> Hi, This is the first non-trivial patch to autovacuum multiple workers. This patch that adds the "recheck" logic to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 10:47 AM
Alvaro Herrera
 
Posts: n/a
Default autovacuum: recheck logic

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"


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:16 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com