Skip site navigation (1) Skip section navigation (2)

Re: [patch] libpq one-row-at-a-time API

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [patch] libpq one-row-at-a-time API
Date: 2012-07-24 16:39:56
Message-ID: CACMqXCJZgVn+rVYiCsZxh_wSRRdcPuHsa-6YbHygLu+f7CVQ8Q@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, Jul 24, 2012 at 7:25 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Tue, Jul 24, 2012 at 11:08 AM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>>> I'm arguing that *all* data getting must continue to do so through the
>>> result object, and bypassing the result to get at data is breaking the
>>> result abstraction in the libpq api.  I bet you can still maintain
>>> data access through result object while avoiding extra copies.
>>
>> Well, the main problem this week is whether we should
>> apply PQsetSingleRowMode() from single-row-mode1
>> or from single-row-mode2 branch?
>>
>> The PQgetRowData() is unimportant as it just exposes
>> the rowBuf to user and thats all.
>
> right. branch 1 (containing PQgetRowData) seems wrong to me.

Indeed, you are missing the fact that PGgetResult works same
in both branches.,

And please see the benchmart I posted.

Even better, run it yourself...

>> What do you mean by that?  And have you though about both
>> sync and async usage patterns?
>
> No, I haven't -- at least not very well.  The basic idea is that
> PQsetSingleRowMode turns into PQgetSingleRowResult() and returns a
> result object.  For row by row an extra API call gets called (maybe
> PQgetNextRow(PGconn, PGresult)) that does the behind the scenes work
> under the existing result object.  This is the same general structure
> you have in branch 2, but the result allocation is move out of the
> loop.  Presumably sync and async would then follow the same pattern,
> but we'd still have to be able to guarantee non-blocking behavior in
> the async api.

Well, as discussed previously it's worthwhile to keep standard functions
like PQisBusy() and PQgetResult() working sensibly in new mode,
and currently they do so.

If you add new functions, you also need to define the behavior
when new and old one's are mixed and it gets messy quickly.

-- 
marko

In response to

Responses

pgsql-hackers by date

Next:From: Merlin MoncureDate: 2012-07-24 16:52:10
Subject: Re: [patch] libpq one-row-at-a-time API
Previous:From: Marko KreenDate: 2012-07-24 16:35:05
Subject: Re: [patch] libpq one-row-at-a-time API

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group