Re: Disable WAL logging to speed up data loading

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>, 'David Steele' <david(at)pgmasters(dot)net>, "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>, 'Kyotaro Horiguchi' <horikyota(dot)ntt(at)gmail(dot)com>, "sawada(dot)mshk(at)gmail(dot)com" <sawada(dot)mshk(at)gmail(dot)com>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "masao(dot)fujii(at)oss(dot)nttdata(dot)com" <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, "ashutosh(dot)bapat(dot)oss(at)gmail(dot)com" <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Disable WAL logging to speed up data loading
Date: 2021-03-22 15:05:43
Message-ID: 20210322150543.GW20766@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Laurenz Albe (laurenz(dot)albe(at)cybertec(dot)at) wrote:
> On Mon, 2021-03-22 at 09:46 -0400, Stephen Frost wrote:
> > * tsunakawa(dot)takay(at)fujitsu(dot)com (tsunakawa(dot)takay(at)fujitsu(dot)com) wrote:
> > > From: Stephen Frost <sfrost(at)snowman(dot)net>
> > > > The argument here seems to stem from the idea that issueing a 'TRUNCATE'
> > > > inside the transaction before starting the 'COPY' command is 'too hard'.
> > >
> > > No, we can't ask using TRUNCATE because the user wants to add data to a table.
> >
> > First- what are you expecting would actually happen during crash
> > recovery in this specific case with your proposed new WAL level?
> >
> > Second, use partitioning, or unlogged tables (with the patch discussed
> > elsewhere to allow flipping them to logged without writing the entire
> > thing to WAL).
>
> Perhaps allowing to set unlogged tables to logged ones without writing WAL
> is a more elegant way to do that, but I cannot see how that would be any
> more crash safe than this patch. Besides, the feature doesn't exist yet.

I'm not suggesting it's somehow more crash safe- but it's at least very
clear what happens in such a case, to wit: the entire table is cleared
on crash recovery.

> So I think that argument doesn't carry much weight.

We're talking about two different ways to accomplish essentially the
same thing- one which introduces a new WAL level, vs. one which adds an
optimization for a WAL level we already have. That the second is more
elegant is more-or-less entirely the point I'm making here, so it seems
pretty relevant.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-03-22 15:13:20 Re: [HACKERS] Custom compression methods
Previous Message Robert Haas 2021-03-22 15:05:19 Re: [HACKERS] Custom compression methods