Replace fetchall by iteration
In #4949 (closed), one of the goal of the change was to replace .fetchall by iteration over the cursor.
Indeed for psycopg2, it will only safe the list creation in memory because psycopg2 fetchall the data any way (except if we use named cursor).
Any way, it is still good to iterate over the cursor instead of .fetchall if the resulted list is never stored.