Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin andsp-gist - Mailing list pgsql-hackers

From Andrey Lepikhov
Subject Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin andsp-gist
Date
Msg-id e8371fe3-aefe-aa91-e87f-1602f9984fed@postgrespro.ru
Whole thread Raw
In response to Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin andsp-gist  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin andsp-gist
List pgsql-hackers

On 25/03/2019 15:21, Heikki Linnakangas wrote:
> I had another quick look.
> 
> I still think using the "generic xlog AM" for this is a wrong level of 
> abstraction, and we should use the XLOG_FPI records for this directly. 
> We can extend XLOG_FPI so that it can store multiple pages in a single 
> record, if it doesn't already handle it.
> 
> Another counter-point to using the generic xlog record is that you're 
> currently doing unnecessary two memcpy's of all pages in the index, in 
> GenericXLogRegisterBuffer() and GenericXLogFinish(). That's not free.
> 
> I guess the generic_log_relation() function can stay where it is, but it 
> should use XLogRegisterBuffer() and XLogInsert() directly.

Patch set v.3 uses XLOG_FPI records directly.

As a benchmark I use the script (test.sql in attachment) which show WAL 
size increment during index build. In the table below you can see the 
influence of the patch on WAL growth.

Results
=======
AM    | master | patch |
GIN    | 347 MB | 66 MB |
GiST    | 157 MB | 43 MB |
SP-GiST | 119 MB | 38 MB |

-- 
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: speeding up planning with partitions
Next
From: Haribabu Kommi
Date:
Subject: Re: Pluggable Storage - Andres's take