I am working on complex query that takes hours to execute. I am using PSycopg2 to
By reading this Post . I added this statement :
import os.environ
['PGOPTIONS'] = '-c statement_timeout=1000000'
Now, I am getting an error every-time, I execute this query :
import psycopg2
>>> cnn = psycopg2.connect("dbname=test options='-c statement_timeout=1000'")
>>> cur = cnn.cursor()
>>> cur.execute("select pg_sleep(200000)")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
psycopg2.extensions.QueryCanceledError: canceling statement due to statement timeout
My question: How can I force the application to take a long time to process the query ?