Re: New gist vacuum.

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Костя Кузнецов <chapaev28(at)ya(dot)ru>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: New gist vacuum.
Date: 2017-12-19 10:58:35
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi hackers!

Here is the patch that deletes pages during GiST VACUUM.

> 12 нояб. 2017 г., в 23:20, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> написал(а):
> If author and community do not object, I want to continue work on Konstantin's patch.

Long story short, some time ago Konstantin Kuznetsov hacked out a patch that added GiST scan with physical order of scan.
This scan is using a lot of memory to build map of whole GiST graph. If there is not enough maintenance memory, patch had the fallback to old GiST VACUUM.
New behavior was deleting pages while old (still used) was not.

I've rebased patch, fixed some bugs and decided that it solves too much in a single step.

Here is the patch, which adds functionality of GiST page deletes.
If this is committed, porting physical scan code will be much easier.

==What is changed==
When GiST VACUUM scans graph for removed tuples, it remembers internal pages that are referencing completely empty leaf pages.
Then in additional step, these pages are rescanned to delete references and mark leaf pages as free.

At least one reference on each internal pages is left undeleted to preserve balancing of the tree.
Pages that has FOLLOW-RIGHT flag also are not deleted, even if empty.

Thank you for your attention, any thoughts are welcome.

Best regards, Andrey Borodin.

Attachment Content-Type Size
0001-Delete-pages-during-GiST-VACCUM.patch application/octet-stream 13.9 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Андрей Жиденков 2017-12-19 11:28:00 Notes about Pl/PgSQL assignment performance
Previous Message Yugo Nagata 2017-12-19 10:40:17 Re: [HACKERS] [PATCH] Lockable views