[MASSMAIL] Multiple COPY statements for one table vs one for ~half a billion records

Поиск
Список
Период
Сортировка
От Carl L
Тема [MASSMAIL] Multiple COPY statements for one table vs one for ~half a billion records
Дата
Msg-id CAPtGvF9i5XunrgFUWYrCLnmnD0akdLKBQLdO1qsz9C5nz0m3ZQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Multiple COPY statements for one table vs one for ~half a billion records  (Ron Johnson <ronljohnsonjr@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Moving delta data faster
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Multiple COPY statements for one table vs one for ~half a billion records