Re: [PATCH] Microvacuum for gist.

From: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Microvacuum for gist.
Date: 2015-09-07 15:53:40
Message-ID: 55EDB304.5020006@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

04.09.2015 15:11, Teodor Sigaev:
> Some notices
>
> 1 gistvacuumpage():
> OffsetNumber deletable[MaxOffsetNumber];
> Seems, MaxOffsetNumber is too much, MaxIndexTuplesPerPage is enough

Fixed.

> 2 Loop in gistkillitems() for searching heap pointer. It seems to me that
> it could be a performance problem. To fix it, it's needed to remember
> index tuple's offset number somewhere near
> GISTScanOpaqueData->killedItems. And
> gistkillitems() will loop over offsets and compare heap pointer from
> killedItems and index tuple, if they doesn't match then just skip this
> index tuple.
Thanks for suggestion. I've rewritten this function. Now killedItems[]
contains only OffsetNumbers of tuples which we are going to delete.
PageLSN check is enough to ensure that nothing has changed on the page.
Heap pointer recheck is unnecessary. (It's really important for btree,
where tuple could be inserted in the middle of page. But we can't have
such situation for GiST index page).
It works 50% faster than before.

> 3 Connected with previous, could you show some performance tests?

Perfomance test is attached.
Test is following - portion of tuples is deleted and after that selected
several times.

Without microvacuum. All 'select' queries are executed at about same time
Time: 360,468 ms
Time: 243,197 ms
Time: 238,310 ms
Time: 238,018 ms

With microvacuum. First 'select' invokes gistkillitems(). It's executed
a bit slower than before.
But following queries are executed significantly faster than without
microvacuum.
Time: 368,780 ms
Time: 69,769 ms
Time: 9,545 ms
Time: 12,427 ms

Please, review the patch again. I could have missed something.

P.S. Do I need to write any documentation update?

--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
microvacuum_for_gist_5.patch text/x-patch 10.3 KB
m_test.sql application/sql 867 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2015-09-07 16:05:10 LLVM Address Sanitizer (ASAN) and valgrind support
Previous Message Teodor Sigaev 2015-09-07 15:41:02 Re: WIP: Access method extendability