pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: olivier.gosseaume@free.fr
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13484: Performance problem with logical decoding
Date: Mon, 6 Jul 2015 22:41:38 +0200
Message-ID: <20150706204138.GC340@alap3.anarazel.de> (raw)
In-Reply-To: <1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net>
References: <DAE4FF93-DB6B-439A-A287-4CCB5068599A@anarazel.de>
	<1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2015-07-06 19:29:30 +0200, olivier.gosseaume@free.fr wrote:
> Just after having submitted the bug report, i saw that when a
> transaction have 4096 or more operations (inserts for example), I see
> postgres generating files in pg_repslot/my_slot directory. Is that
> what you call "spilling to disk"?

Yes.

> To be more concise :
> - ONE transaction with 4095 operations -> consumed in 80mS
> - TEN transactions with 4095 operations each (so 40950 operations) -> 380mS (which as you said is very good -less than linear growth-)
> - ONE transaction with 4096 operations -> consumed in 4204mS (ouch ...). I confirm there are only 4096 changes in one transaction
> - TEN transactions with 4095 operations each (so 40950 operations) -> 34998mS, ouch again

FWIW, I can't reproduce those results at all. I just tried, and for me
all results are 34ms, 121ms, 149ms, 374ms. When using the streaming
interface there's no discernible delays at all.

> I need some sort of change data capture mechanism (CDC) to detect
> changes on data (async is ok for me as long as i get very low
> latency). I could use triggers but performance would suffer. Reading
> the WAL log seems like it could be a good approach.

Right, that sounds pretty typical.

> I also tried pg_recvlogical feeding a file, but got the exact same
> results so i'm stuck.

Are you stopping pg_recvlogical between the runs, or are you letting it
run? The point of using it is that it's a streaming, i.e. that you do
not need to pay to "startup" costs of logical decoding, which can be
noticeable.

> What is observe is that the spilling occurs, and
> when the .snap file is created then pg_recvlogical will consume data
> but it does take a long time exactly the same time as
> pg_logical_slot_get_changes in fact.

Another possibility is that there's some windows specific problem here.

> BTW there is also a bug in pg_recvlogical with option -f - (output to
> stdout), pg_recvlogical tries to flush with fsync which does not work
> on windows and display an error message.

Uh, that should obviously not be the case. Thanks for the report, will
fix.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (19+ messages)  latest in thread

Message-ID: <20150706204138.GC340@alap3.anarazel.de>
Permalink:  ../20150706204138.GC340@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20150706204138.GC340@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, olivier.gosseaume@free.fr
  Subject: Re: BUG #13484: Performance problem with logical decoding
  In-Reply-To: <20150706204138.GC340@alap3.anarazel.de>
  References: <DAE4FF93-DB6B-439A-A287-4CCB5068599A@anarazel.de> <1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net> <20150706204138.GC340@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox