[MASSMAIL] Multiple COPY statements for one table vs one for ~half a billion records - Mailing list pgsql-general

From Carl L
Subject [MASSMAIL] Multiple COPY statements for one table vs one for ~half a billion records
Date
Msg-id CAPtGvF9i5XunrgFUWYrCLnmnD0akdLKBQLdO1qsz9C5nz0m3ZQ@mail.gmail.com
Whole thread Raw
Responses Re: Multiple COPY statements for one table vs one for ~half a billion records  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
Hi there,

I have around half a billion records that are being generated from a back end that are split into 80 threads (one per core) and I'm performing a copy from memory ( from stdin binary) into Postgres from each of these threads - i.e. there are 80 COPY statements being generated for one table that are running concurrently. I can see each of the Postgres processes sitting at around 15% CPU usage.

These are all also in the same transaction - I am the only one connected, so it's not an issue to hold a big transaction.

I can see that many of the Postgres threads have a wait event "LWLock: BufferContent", which I assume means that they are waiting for each other before they can write to the table. Therefore, would it be more efficient to combine all of these and put them into one COPY statement?

Thanks!

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Moving delta data faster
Next
From: Ron Johnson
Date:
Subject: Re: Multiple COPY statements for one table vs one for ~half a billion records