In Python is library psycopg
and with that I can do queries.
I have an array with texts and I just iterate over them and run query to find this text in postgres. But some time the query takes so much time to execute and in that moment I want to stop/terminate this query and go to the next. For example if query takes 10sec or longer I need to stop it and go to the next.
Is it possible with psycopg? Or maybe it is possible with something else?
Using statment_timeout to cancel statement that runs long. Use
options
parameter to pass instatement_timeout
setting. By default the integer value is in milliseconds. It can be modified with units e.g.10s
= 10 seconds.