npgsql/Npgsql — pull request #112 by glenebob (2013-12-03 00:25:58+00:00)
Title: Command timeout

Francisco,

This PR utilizes PG's statement_timeout parameter to implement statement timeout. There are some trade offs here that should be mentioned and reviewed:

Pro: We should almost never have to do the work required to tell PG to cancel a request in progress (due to timeout).

Pro: The error from PG on timeout is more relevant ("...due to statement timeout") than what a timeout currently results in ("...due to user request").

Con: Whenever commandTimeout differs from the last value sent to the backend, it has to be sent again, representing an overhead that could be substantial depending on how Npgsql us used.

Con (barely): If PG fails to send a timeout error in a timely fashion (a "timeout error timeout", so to speak), the frontend's timeout logic will cause an additional 5 seconds to elapse before the cancel-request method is used, in violation of the user's timeout value.

Glen