Re: How to copy rows into same table efficiently - Mailing list pgsql-general

From David G. Johnston
Subject Re: How to copy rows into same table efficiently
Date
Msg-id CAKFQuwY1yFQw=yryUyJbKhaYhFsQrX97rp46SYU0y=4Zvuc5gw@mail.gmail.com
Whole thread Raw
In response to Re: How to copy rows into same table efficiently  (Ron <ronljohnsonjr@gmail.com>)
List pgsql-general
On Tue, Oct 26, 2021 at 2:06 AM Ron <ronljohnsonjr@gmail.com> wrote:
Anyway, for millions of rows, I might use COPY instead of INSERT (depending
on how many millions, how many indices, how large the rows, how fast the
machine, etc.


I don't imagine using COPY TO to write the data to a file and then COPY FROM to import it is going to be an improvement over INSERT-SELECT.

Now, if you can perform the COPY TO on a replica and then only run the COPY FROM on the primary that might be worth it.  Avoiding the I/O for the read on the primary would be a big win.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Determining if a table really changed in a trigger
Next
From: Marcos Pegoraro
Date:
Subject: Re: Determining if a table really changed in a trigger