Re: COPY and heap_sync

From: Amit Kapila <amit(dot)kapila16(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-08-30 07:36:03
Message-ID: CAA4eK1Ke7+872kFsBSHYFYy8E=Lv1d19wAt0gwQjTvabFZQ=TQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 30, 2014 at 11:56 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?

Wouldn't unconditionally delaying sync until end of transaction
can lead to burst of I/O at that time especially if there are many
such copy commands in a transaction, leading to delay in some
other operation's that might be happening concurrently in the
system.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Atri Sharma 2014-08-30 08:05:02 Re: COPY and heap_sync
Previous Message Amit Kapila 2014-08-30 07:20:25 Re: Per table autovacuum vacuum cost limit behaviour strange