Re: alter table xxx set unlogged take long time

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "James Pang (chaolpan)" <chaolpan(at)cisco(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Mlodgenski <jimmy76(at)gmail(dot)com>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: alter table xxx set unlogged take long time
Date: 2022-07-26 15:03:33
Message-ID: CAKFQuwapFJBOdUPs=ZYsVcDiticJ3mDR2NZ2KxrknPoYBO3iaw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Jul 26, 2022 at 5:45 AM James Pang (chaolpan) <chaolpan(at)cisco(dot)com>
wrote:

> Without step 3 , copy data take long time. Use wal_level=minimal can
> help make COPY load data without logging ?
>
>
I believe you are referring to:

https://www.postgresql.org/docs/current/populate.html#POPULATE-COPY-FROM

Since the final state of your table will be "logged" relying on the above
optimization is the correct path, if you enable "logged" at the end, even
with wal_level=minimal, you do not benefit from the optimization and thus
your data ends up being written to WAL.

Otherwise, it is overall time that matters, it's no use boasting the COPY
is fast if you end up spending hours waiting for ALTER TABLE at the end.

David J.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Rick Otten 2022-07-27 12:55:14 Postgresql 14 partitioning advice
Previous Message James Pang (chaolpan) 2022-07-26 12:59:15 RE: alter table xxx set unlogged take long time