Re: question about CURSOR

From: Neil Conway <neilc(at)samurai(dot)com>
To: ivan <iv(at)psycho(dot)pl>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: question about CURSOR
Date: 2003-10-14 04:28:14
Message-ID: 1066105693.405.9.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2003-10-12 at 05:42, ivan wrote:
> Hi, How can i check how many tules has my declared cursor ?

You can't know the # of tuples produced by a query without producing its
entire result set. Since DECLARE doesn't actually evaluate the query you
specify (... which is the whole point of using cursors to begin with),
it can't report the size of the query's result set.

> One more question , when i use declare cursor to show select on grid,
> better is to use cursor in BEGIN/END WORK, or WITH HOLD ?

I have no idea what this question means.

In any case, the current implementation of holdable cursors materializes
the cursor's result set when the cursor's creating transaction commits.
So it's not very high-performance for large result sets...

-Neil

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-14 04:37:20 Re: fix for strict-alias warnings
Previous Message Jan Wieck 2003-10-14 04:20:32 Re: 2-phase commit