Re: [patch] libpq one-row-at-a-time API - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: [patch] libpq one-row-at-a-time API
Date
Msg-id 50173BF7.1070801@Yahoo.com
Whole thread Raw
In response to Re: [patch] libpq one-row-at-a-time API  (Leon Smith <leon.p.smith@gmail.com>)
Responses Re: [patch] libpq one-row-at-a-time API  (Leon Smith <leon.p.smith@gmail.com>)
List pgsql-hackers
On 7/30/2012 8:11 PM, Leon Smith wrote:
> One other possibility,  Tom Lane fretted ever so slightly about the use
> of malloc/free per row... what about instead of PQsetSingleRowMode,  you
> have PQsetChunkedRowMode that takes a chunkSize parameter.   A chunkSize
> <= 0 would be equivalent to what we have today,   a chunkSize of 1 means
> you get what you have from PQsetSingleRowMode,  and larger chunkSizes
> would wait until n rows have been received before returning them all in
> a single result.      I don't know that this suggestion is all that
> important, but it seems like an obvious generalization that might
> possibly be useful.

It is questionable if that actually adds any useful functionality. Any 
"collecting" of multiple rows will only run the risk to stall receiving 
the following rows while processing this batch. Processing each row as 
soon as it is available will ensure making most use network buffers.

Collecting multiple rows, like in the FETCH command for cursors does, 
makes sense when each batch introduces a network round trip, like for 
the FETCH command. But does it make any sense for a true streaming mode, 
like what is discussed here?


Jan

-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin


pgsql-hackers by date:

Previous
From: Leon Smith
Date:
Subject: Re: [patch] libpq one-row-at-a-time API
Next
From: Leon Smith
Date:
Subject: Re: [patch] libpq one-row-at-a-time API