cursor.fetchall() vs list(cursor) in Python
问题 Both methods return a list of the returned items of the query, did I miss something here? Or they have identical usages indeed? Any differences performance-wise? 回答1: If you are using the default cursor, a MySQLdb.cursors.Cursor , the entire result set will be stored on the client side (i.e. in a Python list) by the time the cursor.execute() is completed. Therefore, even if you use for row in cursor: you will not be getting any reduction in memory footprint. The entire result set has already