how not to run out of memory in cursor.execute

johnlichtenstein at gmail.com johnlichtenstein at gmail.com
Sun Jun 4 15:04:55 EDT 2006


I am using cx_Oracle and MySQLdb to pull a lot of data from some tables
and I find that the cursor.execute method uses a lot of memory that
never gets garbage collected. Using fetchmany instead of fetchall does
not seem to make any difference, since it's the execute that uses
memory. Breaking the query down to build lots of small tables doesn't
help, since execute doesn't give its memory back, after reading enough
small tables execute returns a memory error. What is the trick to get
memory back from execute in cx_Oracle and MySQLdb?




More information about the Python-list mailing list