Re: alter table xxx set unlogged take long time - Mailing list pgsql-performance

From Tom Lane
Subject Re: alter table xxx set unlogged take long time
Date
Msg-id 2883168.1658933183@sss.pgh.pa.us
Whole thread Raw
In response to Re: alter table xxx set unlogged take long time  (Joe Conway <mail@joeconway.com>)
Responses Re: alter table xxx set unlogged take long time  (Joe Conway <mail@joeconway.com>)
List pgsql-performance
Joe Conway <mail@joeconway.com> writes:
> Then (completely untested) I *think* you could create the "partition" 
> initially as a free standing unlogged table, load it, index it, switch 
> to logged, and then attach it to the partitioned table.

I'm still of the opinion that this plan to load the data unlogged
and switch to logged later is a loser.  Sooner or later you have
got to write the data to WAL, and this approach doesn't eliminate
that cost.  What it does do is create one whole extra cycle of
writing the data to disk and reading it back.  I don't think
it's an oversight that no such thing is suggested in our standard
tips for bulk-loading data:

https://www.postgresql.org/docs/current/populate.html

What perhaps *is* an oversight is that we don't suggest
use of COPY FREEZE there.  AFAIK that doesn't reduce the initial
data loading cost directly, but it would save overhead later.

            regards, tom lane



pgsql-performance by date:

Previous
From: Joe Conway
Date:
Subject: Re: alter table xxx set unlogged take long time
Next
From: Joe Conway
Date:
Subject: Re: alter table xxx set unlogged take long time