Re: expected behavior of fetchmany()

Robert Coup <[email protected]> Thu, 4 Mar 2010 09:10:31 +1300
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
I think what Ben is trying to say is that server-side cursors in
Postgres do not build the entire resultset in memory, on either the
server or the client side. As you fetch more from the cursor, it

As Frederico said, fetchmany() does the same as fetchall() for a
client-side cursor - the entire resultset is built in memory on the
server, and then transferred to the client, regardless of how many or
which records you access.

So you want a server-side (named) cursor :) See
http://initd.org/psycopg/docs/usage.html#server-side-cursors

HTH,

Rob :)