Re: alter table xxx set unlogged take long time

2022-07-28 Thread Joe Conway
On 7/28/22 03:47, James Pang (chaolpan) wrote: Does "wal_level=minimal" help reducing wal emitting a lot for COPY and CREATE INDEX? We plan to remove "set unlogged/log" , instead , just set "wal_level=minimal" ,then COPY data in parallel, then create index. (Note - please don't top post on

RE: alter table xxx set unlogged take long time

2022-07-28 Thread James Pang (chaolpan)
e- From: Joe Conway Sent: Wednesday, July 27, 2022 11:02 PM To: Tom Lane Cc: James Pang (chaolpan) ; Jim Mlodgenski ; pgsql-performance@lists.postgresql.org Subject: Re: alter table xxx set unlogged take long time On 7/27/22 10:46, Tom Lane wrote: > Joe Conway writes: >> Then (c

Re: alter table xxx set unlogged take long time

2022-07-27 Thread Kyotaro Horiguchi
At Tue, 26 Jul 2022 12:41:07 +, "James Pang (chaolpan)" 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 in

Re: alter table xxx set unlogged take long time

2022-07-27 Thread Joe Conway
On 7/27/22 10:46, Tom Lane wrote: Joe Conway 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

Re: alter table xxx set unlogged take long time

2022-07-27 Thread Tom Lane
Joe Conway 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 swi

Re: alter table xxx set unlogged take long time

2022-07-27 Thread Joe Conway
On 7/26/22 08:59, James Pang (chaolpan) wrote:    We use JDBC to export data into csv ,then copy that to Postgres. Multiple sessions working on multiple tables.  If not set unlogged , how to make COPY run fast ?   possible to start a transaction include all of these  “truncate table xxx; copy

Re: alter table xxx set unlogged take long time

2022-07-26 Thread David G. Johnston
On Tue, Jul 26, 2022 at 5:45 AM James Pang (chaolpan) 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

RE: alter table xxx set unlogged take long time

2022-07-26 Thread James Pang (chaolpan)
wal_level=minimal, is it ok to make copy and create index without logging ? James From: Jim Mlodgenski Sent: Tuesday, July 26, 2022 8:53 PM To: James Pang (chaolpan) Cc: Tom Lane ; pgsql-performance@lists.postgresql.org Subject: Re: alter table xxx set unlogged take long time On Tue, Jul 26

Re: alter table xxx set unlogged take long time

2022-07-26 Thread Jim Mlodgenski
om: Tom Lane > Sent: Tuesday, July 26, 2022 8:43 PM > To: James Pang (chaolpan) > Cc: Jim Mlodgenski ; > pgsql-performance@lists.postgresql.org > Subject: Re: alter table xxx set unlogged take long time > > "James Pang (chaolpan)" writes: > > How to make it fast ?

RE: alter table xxx set unlogged take long time

2022-07-26 Thread James Pang (chaolpan)
@lists.postgresql.org Subject: Re: alter table xxx set unlogged take long time "James Pang (chaolpan)" writes: > 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

Re: alter table xxx set unlogged take long time

2022-07-26 Thread Tom Lane
"James Pang (chaolpan)" writes: > 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

RE: alter table xxx set unlogged take long time

2022-07-26 Thread James Pang (chaolpan)
long time ,especially for large tables. Thank, James From: Jim Mlodgenski Sent: Tuesday, July 26, 2022 8:21 PM To: James Pang (chaolpan) Cc: pgsql-performance@lists.postgresql.org Subject: Re: alter table xxx set unlogged take long time On Tue, Jul 26, 2022 at 4:53 AM James Pang (chaolpan

Re: alter table xxx set unlogged take long time

2022-07-26 Thread Jim Mlodgenski
On Tue, Jul 26, 2022 at 4:53 AM James Pang (chaolpan) wrote: > Hi , > > We have PG v13.6 in RHEL8.4, we try to set table unlogged before load > data. There are a lot of existing data in this table, when ‘alter table > xxx set unlogged’, we found it take long time and spend time on IO > datafile