setQueryTimeout effects on performance
324307Dec 1 2010 — edited Dec 22 2010I'm supporting an application that performs a relatively large number of JDBC calls. Some of the queries are long running and I need to have them to timeout using setQueryTimeout. I have the option of either selectively setting this timeout for a few known troublesome SQL calls or I could set this timeout for all SQL calls (by wrapping the connection and setting all retrieved statements timeouts). The second option has the advantage that it would catch database requests that are long running and we didn't recognize as a problem. The downside to this is it will be setting the timeout for a lot of requests that don't need it.
My question is, how much of a performance hit do I take when setting a setQueryTimeout? Presumably an additional thread is created for monitoring the time in the background (Or maybe this is more efficient with one thread for all timeouts)? Obviously, one extra timeout won't make a difference but a lot might.
thanks
P