Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

setQueryTimeout effects on performance

324307Dec 1 2010 — edited Dec 22 2010
I'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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2011
Added on Dec 1 2010
5 comments
1,825 views