Re: Make autovacuum sort tables in descending order of xid_age - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: Make autovacuum sort tables in descending order of xid_age
Date
Msg-id 2488acea-328b-1328-d437-8c156bc8f7a4@gmail.com
Whole thread Raw
In response to Re: Make autovacuum sort tables in descending order of xid_age  (David Fetter <david@fetter.org>)
Responses Re: Make autovacuum sort tables in descending order of xid_age  (David Fetter <david@fetter.org>)
List pgsql-hackers

On 11/29/19 2:21 PM, David Fetter wrote:
> On Fri, Nov 29, 2019 at 07:01:39PM +0100, David Fetter wrote:
>> Folks,
>>
>> Per a suggestion Christophe made, please find attached a patch to
>> $Subject:
>>
>> Apart from carefully fudging with pg_resetwal, and short of running in
>> production for a few weeks, what would be some good ways to test this?
> 
> Per discussion on IRC with Sehrope Sarkuni, please find attached a
> patch with one fewer bug, this one in the repalloc() calls.

Hello David,

Here are my initial thoughts.

Although you appear to be tackling the problem of vacuuming tables
with older Xids first *per database*, have you considered changing
the logic in building and sorting the database list in get_database_list
and rebuild_database_list?  I'm just curious what your thoughts
might be on this subject.

As far as sorting the list of tables in an array and then copying
that array into a linked list, I think there is no need.  The
copying of table_ages into table_oids is followed immediately by

   foreach(cell, table_oids)

and then table_oids seems not to serve any further purpose.  Perhaps
you can just iterate over table_ages directly and avoid the extra
copying.

I have not tested this change, but I may do so later today or perhaps
on Monday.

-- 
Mark Dilger



pgsql-hackers by date:

Previous
From: Sergei Kornilov
Date:
Subject: Re: [HACKERS] Block level parallel vacuum
Next
From: Bruce Momjian
Date:
Subject: Re: Append with naive multiplexing of FDWs