Re: Streaming LIBPQ? Sliding Window in LIBPQ?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Abraham, Danny" <danny_abraham(at)bmc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Streaming LIBPQ? Sliding Window in LIBPQ?
Date: 2007-11-28 17:32:34
Message-ID: b42b73150711280932h4106a4b6pfa8ef2e7a8a13dc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 28, 2007 10:51 AM, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> The trick was to set non-blocking mode and send an async query. Then
> PQisBusy() would return false when any data had been received, not just
> when all data had been received. At that point you could call
> PQgetResult to get those rows. You would get a zero-length result when
> you reached the end of data.
>
> Admittedly, I havn't tested it on recent versions. The program I posted
> a while back that tested if the locks blocked as documented drove two
> connections simultaneously this way.
>
> http://archives.postgresql.org/pgsql-hackers/2005-08/msg01073.php
> http://archives.postgresql.org/pgsql-general/2006-07/msg00806.php

aiui, PQgetResult does not allow streaming of partial results. it does
however allow returning multiple results for multiple queries sent in
a batch...so, a 'kinda sorta' streaming could be rigged in certain
cases if the big query could be split to multiple queries and chained.
pulling back and using a piece of a single result is not possible,
and never has been. also, there is always the cursor technique which
i only find appealing in very special circumstances.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2007-11-28 17:37:43 Re: Select all fields except one
Previous Message Gauthier, Dave 2007-11-28 17:28:43 Re: Select all fields except one