pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Subject: unbuffered results from libpq?
2+ messages / 2 participants
[nested] [flat]
* Re: Subject: unbuffered results from libpq?
@ 2001-05-18 15:32 Alexey Nalbat <alexey@price.ru>
2001-05-21 15:05 ` Re: Subject: unbuffered results from libpq? Timothy H. Keitt <Timothy.Keitt@StonyBrook.Edu>
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Nalbat @ 2001-05-18 15:32 UTC (permalink / raw)
To: Timothy.Keitt@StonyBrook.Edu; pgsql-interfaces
Hello.
I have exactly the same question. Could anybody answer it?
My impression is that it can't be maid. Even use of functions PQsetnonblocking,
PQsendQuery, PQgetResult, PQconsumeInput,.. doesn't help. Is it so?
Thanks.
> My impression is that libpq buffers all results of a query. Is there a
> way to get a "result stream" from the backend instead of having libpq
> read everything into a local buffer first? Currently, my application,
> after a query, simply copies the entire buffer from the libpq side into
> storage on the application side. This seems expensive for large
> queries. I'd rather read results directly into storage on the
> application side, i.e., "while input get next value from backend". (I
> know about libpqeasy, but this only iterates over the libpq buffer.)
--
WBR, Alexey Nalbat
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Subject: unbuffered results from libpq?
2001-05-18 15:32 Re: Subject: unbuffered results from libpq? Alexey Nalbat <alexey@price.ru>
@ 2001-05-21 15:05 ` Timothy H. Keitt <Timothy.Keitt@StonyBrook.Edu>
0 siblings, 0 replies; 2+ messages in thread
From: Timothy H. Keitt @ 2001-05-21 15:05 UTC (permalink / raw)
To: alexey@price.ru; +Cc: pgsql-interfaces
I realized after this post that one solution is to use a cursor. You
can then fetch in small chuncks and write to a local buffer. The
problem for a general interface applicaiton such as mine is nested
transactions --- cursors can only be used within transactions which will
fail if the the user has independently initiated a transaction (unless
this has been fixed).
Tim
Alexey Nalbat wrote:
> Hello.
>
> I have exactly the same question. Could anybody answer it?
>
> My impression is that it can't be maid. Even use of functions PQsetnonblocking,
> PQsendQuery, PQgetResult, PQconsumeInput,.. doesn't help. Is it so?
>
> Thanks.
>
>
>>My impression is that libpq buffers all results of a query. Is there a
>>way to get a "result stream" from the backend instead of having libpq
>>read everything into a local buffer first? Currently, my application,
>>after a query, simply copies the entire buffer from the libpq side into
>>storage on the application side. This seems expensive for large
>>queries. I'd rather read results directly into storage on the
>>application side, i.e., "while input get next value from backend". (I
>>know about libpqeasy, but this only iterates over the libpq buffer.)
>>
>
--
Timothy H. Keitt
Department of Ecology and Evolution
State University of New York at Stony Brook
Stony Brook, New York 11794 USA
Phone: 631-632-1101, FAX: 631-632-7626
http://life.bio.sunysb.edu/ee/keitt/
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-21 15:05 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-18 15:32 Re: Subject: unbuffered results from libpq? Alexey Nalbat <alexey@price.ru>
2001-05-21 15:05 ` Timothy H. Keitt <Timothy.Keitt@StonyBrook.Edu>
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