Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGJtr-0007Xn-9o for pgsql-performance@arkaria.postgresql.org; Tue, 26 Jul 2022 12:42:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oGJtq-0003Rz-5T for pgsql-performance@arkaria.postgresql.org; Tue, 26 Jul 2022 12:42:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGJtp-0003Rn-Rh for pgsql-performance@lists.postgresql.org; Tue, 26 Jul 2022 12:42:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGJtn-0005zf-Lm for pgsql-performance@lists.postgresql.org; Tue, 26 Jul 2022 12:42:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26QCgqAZ2240968; Tue, 26 Jul 2022 08:42:52 -0400 From: Tom Lane To: "James Pang (chaolpan)" cc: Jim Mlodgenski , "pgsql-performance@lists.postgresql.org" Subject: Re: alter table xxx set unlogged take long time In-reply-to: References: Comments: In-reply-to "James Pang (chaolpan)" message dated "Tue, 26 Jul 2022 12:41:07 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2240966.1658839372.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Jul 2022 08:42:52 -0400 Message-ID: <2240967.1658839372@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "James Pang (chaolpan)" writes: > How to make it fast ? These are our steps about copy large data from Or= acle to Postgres > 1. Create table in Postgres 2. Extract data from Oracle to CSV 3. A= lter table set xxx unlogged, 4. Run copy command into Postgres db 5. Al= ter table set xxx logged 6. Create index =E2=80=A6 The easy answer is to skip steps 3 and 5. regards, tom lane