Re: memory issue for cur.execute
Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | initd.org |
| Message-ID | <[email protected]> |
Il giorno lun, 05/01/2009 alle 11.51 -0600, Randall Smith ha scritto:
> When issuing a select on a large table, I'm seeing high memory
> consumption before fetching any records (just during cur.execute).
It's psycopg default behaviour. It will fetch everything from the
backend during the execute() call. If you want to use a server-side
cursor and fetch only a few rows at a time use a named cursor:
cur = con.cursor("myname")
cur.execute('select * from my_large_table')
federico
--
Federico Di Gregorio http://people.initd.org/fog
DISCLAIMER. If I receive a message from you, you are agreeing that:
1. I am by definition, "the intended recipient".
2. All information in the email is mine to do with as I see fit and
make such financial profit, political mileage, or good joke as it lends
itself to. In particular, I may quote it on USENET or the WWW.
3. I may take the contents as representing the views of your company.
4. This overrides any disclaimer or statement of confidentiality that
may be included on your message.
_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkliSNYACgkQvcCgrgZGjetjzwCbBh3a5NGs/JAEezVoJYAlm9BM fsAAoMdqyLpRj5Aqngu4ea8RQNyiz+EO =aXn/ -----END PGP SIGNATURE-----