Re: Re[2]: [HACKERS] libpq: why we need to fetch all rows?
Re: Re[2]: [HACKERS] libpq: why we need to fetch all rows?
От:
Bruce Momjian <maillist@candle.pha.pa.us>
Дата:
> > > >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 ------------------------------
Re[2]: [HACKERS] libpq: why we need to fetch all rows?
От:
"Leo Shuster"<lsh@lubrizol.com>
Дата:
>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.
Leo
------------------------------