Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin and sp-gist

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin and sp-gist
Date: 2018-07-10 19:03:09
Message-ID: b929d56e-1c1d-dd5a-e21b-1baf06f6bffe@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28/02/18 18:03, Anastasia Lubennikova wrote:
> Hi,
>
> I want to propose a bunch of patches which allow to reduce WAL traffic
> generated by CREATE INDEX for GiST, GIN and SP-GiST. Similarly to b-tree
> and RUM, we can now log index pages of other access methods only once
> in the end of indexbuild process.

Makes sense. Is there any scenario where the current method is better?
In theory, doing another pass through the whole index, to create the WAL
records, requires more I/O. But in practice, it seems that the reduction
in WAL is almost certainly a win.

> Implementation is based on generic_xlog.

Why? I think we should just add a log_relation() function in
xloginsert.c directly, alongside log_newpage_buffer().

This makes the assumption that all the pages in these indexes used the
standard page layout. I think that's a valid assumption, but needs at
least a comment on that. And perhaps an Assert, to check that
pd_lower/upper look sane.

As a further optimization, would it be a win to WAL-log multiple pages
in each record?

This leaves the XLOG_*_CREATE_INDEX WAL record types unused, BTW.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-07-10 19:21:18 Re: Failure assertion in GROUPS mode of window function in current HEAD
Previous Message Simon Muller 2018-07-10 18:51:00 Re: Allow COPY's 'text' format to output a header