On Tue, Oct 26, 2021 at 2:06 AM Ron <ronljohnsonjr@xxxxxxxxx> 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.