Re: Implementing setQueryTimeout() - Mailing list pgsql-jdbc

From Till Toenges
Subject Re: Implementing setQueryTimeout()
Date
Msg-id 47BA9284.5050407@kyon.de
Whole thread Raw
In response to Re: Implementing setQueryTimeout()  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: Implementing setQueryTimeout()  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Oliver Jowett wrote:
> setQueryTimeout() is documented as:
>
>> Sets the number of seconds the driver will wait for a Statement object
>> to execute to the given number of seconds. If the limit is exceeded,
>> an SQLException is thrown.
>
> That would seem to cover any sort of delay, not just "it is a slow query
> on the server side". If the Statement can't execute in N seconds, return
> an error. That could mean slow network - slow query - whatever.
>
> I don't see why clients that want timeouts care about the cause of the
> slowness -  all they care about is that they get control back within
> some reasonable amount of time, surely? What's the use case where you
> would use setQueryTimeout() but don't actually mean "give me control
> back in N seconds"?

The documentation is unclear. But i think it is intended to limit the
execution time on the server.

And i do care about the cause of the slowness. If i call
setQueryTimeout(), i expect to be able to use the connection after a
timeout, including everything i had SET before, prepared statements etc.
A network timeout or anything worse is handled in an entirely different
part of the code. That is not the responsibility of the driver, and
doesn't event need to be part of the database related code at all.



Till

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: AbstracJdbc2ResultSet getColumnIndex throws missing column when using with Hibernate
Next
From: Oliver Jowett
Date:
Subject: Re: Implementing setQueryTimeout()