> Oops, unfortunately, PQcancel() does not follow any timeout parameters... It uses a blocking socket.
> Also, I still don't think it's a good idea to request cancellation. socket_timeout should be sufficiently longer than the usually expected query execution duration. And long-running queries should be handled bystatement_timeout which indicates the maximum tolerable query execution duration. > For example, if the usually expected query execution time is 100 ms, statement_timeout can be set to 3 seconds and socket_timeout to 5 seconds. Based on your comment it seems to me that 'socket_timeout' should be connected with statement_timeout. I mean that end-user should wait statement_timeout + 'socket_timeout' for returning control. It looks much more safer for me. Best regards, Mikalai Keida