Re: Multiple COPY statements for one table vs one for ~half a billion records

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiple COPY statements for one table vs one for ~half a billion records
Date: 2024-04-04 18:15:40
Message-ID: CANzqJaCBmGpbqc6RS-BubJpeW3aUNiM3knQL0KWOmCFdoeOQvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 4, 2024 at 2:04 PM Carl L <cllewellyno(at)gmail(dot)com> wrote:

> 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.
>

Is the target table partitioned in the same way that the input data is
split?

That would make things faster...

> 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.
>

Unless it fills up your WAL partition.

>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-04-04 18:44:30 Re: What permissions are required for e.g. EXPLAIN UPDATE ...
Previous Message Carl L 2024-04-04 18:03:56 Multiple COPY statements for one table vs one for ~half a billion records