Re: Implementing setQueryTimeout()

From: Till Toenges <tt(at)kyon(dot)de>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, PostgreSQL - JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Implementing setQueryTimeout()
Date: 2008-02-19 08:25:40
Message-ID: 47BA9284.5050407@kyon.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2008-02-19 08:27:22 Re: Implementing setQueryTimeout()
Previous Message Kris Jurka 2008-02-19 06:14:13 Re: AbstracJdbc2ResultSet getColumnIndex throws missing column when using with Hibernate