Re: bad COPY performance with NOTIFY in a trigger

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Filip Rembiałkowski <filip(dot)rembialkowski(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: bad COPY performance with NOTIFY in a trigger
Date: 2016-02-05 19:52:51
Message-ID: CAHyXU0yoHe8Qc=yC10AHU1nFiA1tbHsg+35Ds-oEueUapo7t4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Feb 5, 2016 at 9:33 AM, Filip Rembiałkowski
<filip(dot)rembialkowski(at)gmail(dot)com> wrote:
> patch submitted on -hackers list.
> http://www.postgresql.org/message-id/CAP_rwwn2z0gPOn8GuQ3qDVS5+HgEcG2EzEOyiJtcA=vpDEhoCg@mail.gmail.com
>
> results after the patch:
>
> trigger= BEGIN RETURN NULL; END
> rows=40000
> 228ms COPY test.tab FROM '/tmp/test.dat'
> 205ms COPY test.tab FROM '/tmp/test.dat'
> rows=80000
> 494ms COPY test.tab FROM '/tmp/test.dat'
> 395ms COPY test.tab FROM '/tmp/test.dat'
> rows=120000
> 678ms COPY test.tab FROM '/tmp/test.dat'
> 652ms COPY test.tab FROM '/tmp/test.dat'
> rows=160000
> 956ms COPY test.tab FROM '/tmp/test.dat'
> 822ms COPY test.tab FROM '/tmp/test.dat'
> rows=200000
> 1184ms COPY test.tab FROM '/tmp/test.dat'
> 1072ms COPY test.tab FROM '/tmp/test.dat'
> trigger= BEGIN PERFORM pg_notify('test',NEW.id::text); RETURN NULL; END
> rows=40000
> 440ms COPY test.tab FROM '/tmp/test.dat'
> 406ms COPY test.tab FROM '/tmp/test.dat'
> rows=80000
> 887ms COPY test.tab FROM '/tmp/test.dat'
> 769ms COPY test.tab FROM '/tmp/test.dat'
> rows=120000
> 1346ms COPY test.tab FROM '/tmp/test.dat'
> 1171ms COPY test.tab FROM '/tmp/test.dat'
> rows=160000
> 1710ms COPY test.tab FROM '/tmp/test.dat'
> 1709ms COPY test.tab FROM '/tmp/test.dat'
> rows=200000
> 2189ms COPY test.tab FROM '/tmp/test.dat'
> 2206ms COPY test.tab FROM '/tmp/test.dat'

I'm not so sure that this is a great idea. Generally, we tend to
discourage GUCs that control behavior at the SQL level. Are you 100%
certain that there is no path to optimizing this case without changing
behvior?

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Filip Rembiałkowski 2016-02-06 12:03:53 Re: bad COPY performance with NOTIFY in a trigger
Previous Message Mathieu De Zutter 2016-02-05 15:43:44 Re: View containing a recursive function