Re: New gist vacuum. - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: New gist vacuum.
Date
Msg-id CAPpHfdt2DWPxnr780Lxc2_Vo75Bf7Y4LWM1t9KVhAEuX0SeAWA@mail.gmail.com
Whole thread Raw
In response to Re: New gist vacuum.  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: New gist vacuum.
Re: New gist vacuum.
List pgsql-hackers
Hi!

On Sat, Dec 30, 2017 at 12:18 PM, Andrey Borodin <x4mmm@yandex-team.ru> wrote:
> 28 дек. 2017 г., в 16:37, Andrey Borodin <x4mmm@yandex-team.ru> написал(а):
> Here is new version of the patch for GiST VACUUM.
> There are two main changes:
> 1. During rescan for page deletion only know to be recently empty pages are rescanned.
> 2. I've re-implemented physical scan with array instead of hash table.

There is one more minor spot in GiST VACUUM. It takes heap tuples count for statistics for partial indexes, while it should not.

If gistvacuumcleanup() is not given a statistics gathered by gistbulkdelete() it returns incorrect tuples count for partial index.
Here's the micropatch, which fixes that corner case.
To reproduce this effect I used this query:
create table y as select cube(random()) c from generate_series(1,10000) y; create index on y using gist(c) where c~>1 > 0.5;
vacuum verbose y;
Before patch it will report 10000 tuples, with patch it will report different values around 5000.
 
It's very good that you've fixed that.

I do not know, should I register separate commitfest entry? The code is very close to main GiST VACUUM patch, but solves a bit different problem.

Yes, I think it deserves separate commitfest entry.  Despite it's related to GiST VACUUM, it's a separate fix.
I've made small improvements to this patch: variable naming, formatting, comments.
BTW, do we really need to set shouldCount depending on whether we receive stats argument or not?  What if we always set shouldCount as in the first branch of "if"?
 
shouldCount = !heap_attisnull(rel->rd_indextuple, Anum_pg_index_indpred) ||
   info->estimated_count;


------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

Attachment

pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: proposal: alternative psql commands quit and exit
Next
From: Alexander Korotkov
Date:
Subject: Re: New gist vacuum.