Re: Disable WAL logging to speed up data loading - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: Disable WAL logging to speed up data loading
Date
Msg-id CAD21AoCi5-jVocykn=2wNS+j2KC6dK0BVHhWcHt8VsGuL-s2Bw@mail.gmail.com
Whole thread Raw
In response to RE: Disable WAL logging to speed up data loading  ("tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>)
Responses RE: Disable WAL logging to speed up data loading  ("tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>)
List pgsql-hackers
On Fri, Jan 8, 2021 at 2:12 PM tsunakawa.takay@fujitsu.com
<tsunakawa.takay@fujitsu.com> wrote:
>
> From: Robert Haas <robertmhaas@gmail.com>
> > Were the issues that I mentioned regarding GIST (and maybe other AMs)
> > in the last paragraph of
> > http://postgr.es/m/CA+TgmoZEZ5RONS49C7mEpjhjndqMQtVrz_LCQUkpRW
> > dmRevDnQ@mail.gmail.com
> > addressed in some way? That seems like a pretty hard engineering
> > problem to me, and I don't see that there's been any discussion of it.
> > Those are correctness concerns separate from any wal_level tracking we
> > might want to do to avoid accidental mistakes.
>
> Thank you very much for reminding me of this.  I forgot I replied as follows:
>
>
> --------------------------------------------------
> Unlogged GiST indexes use fake LSNs that are instance-wide.  Unlogged temporary GiST indexes use backend-local
sequencevalues.  Other unlogged and temporary relations don't set LSNs on pages.  So, I think it's enough to call
GetFakeLSNForUnloggedRel()when wal_level = none as well. 
> --------------------------------------------------
>
>
> But this is not correct.  We have to allow (RM_GIST_ID, XLOG_GIST_ASSIGN_LSN) WAL records to be emitted (by tweaking
thefilter in XLogInsert()), just like those WAL records are emitted when wal_level = minimal and and other WAL records
arenot emitted. 

I think it's better to have index AM (and perhaps table AM) control it
instead of filtering in XLogInsert(). Because otherwise third-party
access methods that use LSN like gist indexes cannot write WAL records
at all when wal_level = none even if they want.

Regards,

--
Masahiko Sawada
EnterpriseDB:  https://www.enterprisedb.com/



pgsql-hackers by date:

Previous
From: "Andres Freund"
Date:
Subject: Re: data_checksums enabled by default (was: Move --data-checksums to common options in initdb --help)
Next
From: Amit Kapila
Date:
Subject: Re: Added schema level support for publication.