Re: Re[2]: [HACKERS] libpq: why we need to fetch all rows? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Re[2]: [HACKERS] libpq: why we need to fetch all rows?
Date
Msg-id a64162a301142b0a62d7621a66c900d7
Whole thread Raw
In response to Re[2]: [HACKERS] libpq: why we need to fetch all rows?  ("Leo Shuster"<lsh@lubrizol.com>)
List pgsql-hackers
>
>
> >OK, can you run a test?  If you start a transaction, declare a cursor,
> >and do a fetch over and over again, does it return one line at a time
> >from the server.  I think it does.
> >
> >Now, it will not return from the first fetch until the query has
> >finished executing, but I don't think it will send all the results to
> >the client, only one at a time.
>     When you declare a cursor, the results ARE sent down to the client.
>     The fetch just iterates over the received result set.  No savings
>     are achieved through this technique.  It would be nice if the fetch
>     did return ther result sets one at a time, but that problem has
>     the same issues as returning each row one by one.

IMHO, only FETCH ALL returns all results to the client.  Using fetch
one-by-one seems to re-execute part of the query, which is strange.

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------

pgsql-hackers by date:

Previous
From: PostgreSQL
Date:
Subject: Re: [HACKERS] libpq: why we need to fetch all rows?
Next
From: "Leo Shuster"
Date:
Subject: Re[2]: [HACKERS] libpq: why we need to fetch all rows?