psycopg2 & large result set

Jon Clements joncle at googlemail.com
Fri May 25 05:16:33 EDT 2007


Hi All.

I'm using psycopg2 to retrieve results from a rather large query (it
returns 22m records); unsurprisingly this doesn't fit in memory all at
once. What I'd like to achieve is something similar to a .NET data
provider I have which allows you to set a 'FetchSize' property; it
then retrieves 'n' many rows at a time, and fetches the next 'chunk'
after you read past the end of the current chunk. I suppose I could
use Python for .NET or IronPython but I'd rather stick with CPython
2.5 if possible.

I'm not 100% sure if it's an interface or a server thing. Any ideas
are most welcome.

Cheers,

Jon.




More information about the Python-list mailing list