While MySQL doesn't have server side cursor, MySQLdb has SSCursor class. https://github.com/PyMySQL/mysqlclient-python/blob/master/MySQLdb/cursors.py#L551
Default cursor fetches MySQL response at once and convert them into Python object. SSCursor fetches MySQL response row by row. So it saves Python memory consumption (and MySQL server can't release some resource until client fetches all rows.) To use SScursor: cur = db.cursor() > cur = db.cursor(MySQLdb.cursors.SSCursor) for row in cur.fetchall(): > for row in cur: -- INADA Naoki <songofaca...@gmail.com> -- https://mail.python.org/mailman/listinfo/python-list