Re: alter table xxx set unlogged take long time

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: chaolpan(at)cisco(dot)com
Cc: jimmy76(at)gmail(dot)com, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: alter table xxx set unlogged take long time
Date: 2022-07-28 04:56:59
Message-ID: 20220728.135659.1851781731419305082.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

At Tue, 26 Jul 2022 12:41:07 +0000, "James Pang (chaolpan)" <chaolpan(at)cisco(dot)com> wrote in
> How to make it fast ? These are our steps about copy large data from Oracle to Postgres
>
> 1. Create table in Postgres 2. Extract data from Oracle to CSV 3. Alter table set xxx unlogged, 4. Run copy command into Postgres db 5. Alter table set xxx logged 6. Create index …
> Step 5 took long time ,especially for large tables.

As others pointed, the step5 inevitably requires WAL emittion. On the
other hand, there is a proposed patch [1]. It lets ALTER TABLE SET
LOGGED/UNLOGGED evade duping the whole target table and could reduce
the amount of WAL to be emitted (caused by the difference of
tuple-based WAL and per-page WAL) (in major cases).

Could you try it and see if it works for you in any extent?

regards.

[1] https://commitfest.postgresql.org/38/3461/

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message James Pang (chaolpan) 2022-07-28 07:47:56 RE: alter table xxx set unlogged take long time
Previous Message Jeff Janes 2022-07-27 17:17:23 Re: Postgresql 14 partitioning advice