pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Todd Owen <daxiang.singer@neverbox.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: speeding up inserts by pipelining
Date: Mon, 04 Mar 2013 13:13:58 +0200
Message-ID: <513481F6.70706@vmware.com> (raw)
In-Reply-To: <CACAL9v0uV=nV4WsmntsvBMxxm+3Avpf-taA0TZUxchNgf1V3KQ@mail.gmail.com>
References: <CACAL9v0uV=nV4WsmntsvBMxxm+3Avpf-taA0TZUxchNgf1V3KQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

On 04.03.2013 12:01, Todd Owen wrote:
> Is there any chance of psqlODBC one day supporting query pipelining inside
> the scope of calls to SQLExecute? This doesn't seem like too much effort to
> implement, although the tricky part is probably the semantics in the case
> where some rows succeed and some fail (constaint violations, etc). I'm
> tempted to give it a try myself, if I manage to get the build working under
> VS2010...

Yeah, seems reasonable. I think you'll want to send all the Bind and 
Execute messages, followed by a single Sync message. That means that 
all the queries will run as a single transaction, and if any of them 
fail, all will be rolled back. That seems reasonable, although I don't 
know what the ODBC spec has to say about that.

One tricky aspect is that if you just naively send all the queries 
first, and then start to read the results, you can get a deadlock caused 
by full network buffers. If the client doesn't read the responses before 
it's sent all the queries, the client's receive buffer can fill up with 
the responses from the backend, so that the backend blocks, trying to 
send more responses. And at the same time, the client is blocked while 
trying to send more queries, because the backend's receive buffer is 
already full of incoming queries. I think you'll need to put the socket 
into non-blocking mode, and use select()/poll().

- Heikki


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



view thread (2+ messages)

Message-ID: <513481F6.70706@vmware.com>
Permalink:  ../513481F6.70706@vmware.com/
Also on:    postgresql.org/message-id/513481F6.70706@vmware.com

 · 

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-odbc@postgresql.org
  Cc: hlinnakangas@vmware.com, daxiang.singer@neverbox.com
  Subject: Re: speeding up inserts by pipelining
  In-Reply-To: <513481F6.70706@vmware.com>
  References: <CACAL9v0uV=nV4WsmntsvBMxxm+3Avpf-taA0TZUxchNgf1V3KQ@mail.gmail.com> <513481F6.70706@vmware.com>

* 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