I am not sure which is the most effective or the disadvantages/advantages of each approach or whether they are technically the same thing ?
That is
cursor.execute("DECLARE super_cursor BINARY CURSOR FOR SELECT names FROM myTable")
while True:
cursor.execute("FETCH 1000 FROM super_cursor")
rows = cursor.fetchall()
as expressed in the answer given by alecxe python postgres can I fetchall() 1 million rows?
In comparison to:
while True:
results = cursor.fetchmany(1000)
if not results:
break
for result in results:
yield result
Should one use fetchmany as specified in psycopg2 or DECLARE BINARY.
I Have assumed that fetchmany and DECLARE BINARY both setup a temporary table on the database server side... The client side is an Apache server.
The website I am working with does calculations on user input to that of data in the database... Hence needs to load large amounts of data for pattern matching.
Thank you.