Using Postgres 8.3.1 Consider the following script. In SA 0.4.3 it works as intended. In SA 0.4.6, it does not. In particular, the time to get the resultset in 0.4.3 is sub-second. The time in 0.4.6 is about 20 seconds. Also, when running on 0.4.3 the memory consumption of the script is constant under 10MB. When running on 0.4.6, it grows to hundreds of MB and is dependent on the size of the result set. Seems to me that 0.4.3 used a cursor like it was configured to and 0.4.6 ignored the server_side_cursors=True parameter to the create_engine call. How do I make 0.4.6 use server side cursors?
#!/usr/bin/python from time import time from sqlalchemy import text from sqlalchemy import create_engine stime = time() engine = create_engine('postgres://[EMAIL PROTECTED]/postgres', server_side_cursors=True, encoding='utf-8') conn = engine.connect() trans = conn.begin() print "have engine, connection, transaction after about %.4f seconds" % (time() - stime) stime = time() rs = conn.execute(text("select * from generate_series(1,1000) s0, generate_series(1,10000) s1")) print "have resultset after about %.4f seconds" % (time() - stime) count = 0 stime = time() for r in rs: count += 1 print "counted %s rows after about %.4f seconds" % (count, time() - stime) stime = time() rs.close() print "closed resultset after about %.4f seconds" % (time() - stime) stime = time() trans.commit() print "commited after about %.4f seconds" % (time() - stime) stime = time() conn.close() print "closed connection after about %.4f seconds" % (time() - stime) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---