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

From Kyotaro Horiguchi
Subject Re: alter table xxx set unlogged take long time
Date
Msg-id 20220728.135659.1851781731419305082.horikyota.ntt@gmail.com
Whole thread Raw
In response to RE: alter table xxx set unlogged take long time  ("James Pang (chaolpan)" <chaolpan@cisco.com>)
List pgsql-performance
At Tue, 26 Jul 2022 12:41:07 +0000, "James Pang (chaolpan)" <chaolpan@cisco.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
commandinto 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



pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Postgresql 14 partitioning advice
Next
From: "James Pang (chaolpan)"
Date:
Subject: RE: alter table xxx set unlogged take long time