I have the following case:
conn=ps.connect("dbname='xxxx' user='xxxx' password='xxxx'")
crs = conn.cursor()
statement= """ SELECT *FROM aaaa;
"""
crs.execute(statement)
# get the name of the cars
var = crs.fetchall()
But given the large size of the table, Ubuntu kills the process because of memory issues.
How can I fetch N rows per time in a loop? For instance something like this:
N=1000
for i in range(0,10):
var = crs.fetchmany(0:N)
N+=1000