<div dir="ltr">On Mon, Jul 8, 2013 at 9:03 PM, Leon Smith <span dir="ltr">&lt;<a href="mailto:leon.p.smith@gmail.com" target="_blank">leon.p.smith@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I just fixed a fairly serious performance problem with postgresql-libpq&#39;s binding to PQescapeStringConn;   in was exhibiting a non-linear slowdown when more strings are escaped and retained.</div>

</blockquote><div><br></div><div> I&#39;d like to point out a somewhat related bottleneck in postgresql-simple (but not postgresql-libpq).  Every PQescapeStringConn or PQescapeByteaConn call involves a withMVar, which is about 100ns on the threaded RTS on my system.  Taking the Connection lock once for the whole buildQuery call might be much faster, especially for multi-row inserts and updates.</div>

</div></div></div>