Re: COPY and heap_sync - Mailing list pgsql-hackers

From Robert Haas
Subject Re: COPY and heap_sync
Date
Msg-id CA+Tgmoa3VXCx9GKAON1_FkVcG6_-uo6=S+fL0zj8N2dVTTBptA@mail.gmail.com
Whole thread Raw
In response to COPY and heap_sync  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
On Sat, Aug 30, 2014 at 2:26 AM, Jeff Janes <jeff.janes@gmail.com> wrote:
> If you insert tuples with COPY into a table created or truncated in the same
> transaction, at the end of the COPY it calls heap_sync.
>
> But there cases were people use COPY in a loop with a small amount of data
> in each statement.  Now it is calling heap_sync many times, and if NBuffers
> is large doing that gets very slow.
>
> Could the heap_sync be safely delayed until the end of the transaction,
> rather than the end of the COPY?

I don't think there's any data integrity problem with that, but if the
fsync() should fail it would be reported at commit time rather than in
response to the COPY.  That might be OK though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: postgresql latency & bgwriter not doing its job
Next
From: Peter Geoghegan
Date:
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}