Re: COPY and heap_sync

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY and heap_sync
Date: 2014-09-03 21:11:20
Message-ID: CA+Tgmoa3VXCx9GKAON1_FkVcG6_-uo6=S+fL0zj8N2dVTTBptA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 30, 2014 at 2:26 AM, Jeff Janes <jeff(dot)janes(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-09-03 21:13:00 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Previous Message Robert Haas 2014-09-03 21:08:12 Re: postgresql latency & bgwriter not doing its job