Re: COPY threads - Mailing list pgsql-general

From Christopher Browne
Subject Re: COPY threads
Date
Msg-id CAFNqd5UMtCNiHsMLkirywcZC=QOE=ThEy1ABn6-+rVC5j73g3Q@mail.gmail.com
Whole thread Raw
In response to Re: COPY threads  (Ravi Krishna <srkrishna1@aol.com>)
Responses Re: COPY threads  (Ravi Krishna <srkrishna1@aol.com>)
List pgsql-general
On Wed, 10 Oct 2018 at 16:22, Ravi Krishna <srkrishna1@aol.com> wrote:
> You obviously are referring to multiple connections running COPY on different tables, right?  Like what pg_restore
doeswith -j option.
 
> Doesn't copy take an exclusive lock on the table which makes it incompatible with parallelization.

No, why would that seem to be the case?  If it did so, then you could
not run pg_dump to dump data while regular activity was going on.

That's decidedly not the case.

The challenge in parallelizing a dump via COPY TO is in ensuring that
the multiple requests are attached to the same serializable
transaction.  There's a function now that allows multiple connections
to attach to the same transaction context, I believe...  Also, there's
the challenge in actually splitting the data, so that both requests
are dumping different data; that might be fairly expensive whether
with or without indices.

-- 
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"


pgsql-general by date:

Previous
From: Ravi Krishna
Date:
Subject: Re: COPY threads
Next
From: Ravi Krishna
Date:
Subject: Re: COPY threads