Re: memory issue for cur.execute

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Randall Smith wrote:
>
> I tested again, naming the cursor (without fetching results) and it
> worked as you said it would, but the rowcount returned -1.  Is there a
> way to know how many rows were selected on the server without fetching
> them all?

That's a chicken and egg problem.  In order to know how many records
there were, someone has to have fetched all of the records.  The whole
point of a named cursor is that the server doesn't have to generate the
entire record set immediately.

I would suggest you use a "select count(*)" query first.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.