cursor.execute("SELECT * FROM tableA;")res = cursorProductDB.fetchall()
work_mem = 2048cursor.execute('SET work_mem TO %s', (work_mem,))
i = 0while(i<= 1500000): cursor.execute("SELECT * FROM tableA LIMIT 10000, (10000*i);") res = cursor.fetchall() i += 1
i = 0 while (i <= 1000): cur.execute("SELECT * FROM tableA ORDER BY id LIMIT 100 OFFSET 100*(%s)", (i)) res = cur.fetchall() print len(res) i += 1
while (i <= 1000): cur.execute("SELECT * FROM tableA ORDER BY id LIMIT 100 OFFSET %s" % str(100*i)) res = cur.fetchall() if(len(res) == 0): break i += 1