pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: setQueryTimeOut
3+ messages / 3 participants
[nested] [flat]

* Re: setQueryTimeOut
@ 2004-10-29 23:20  Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Kris Jurka @ 2004-10-29 23:20 UTC (permalink / raw)
  To: Oezcan Acar <acar@bizimalem.com>; +Cc: pgsql-jdbc



On Wed, 27 Oct 2004, Oezcan Acar wrote:

> do you now something new about the implementation of
> Statement.setQueryTimeOut ? As far as I now this method is not
> implemented in the current driver. Do you know, how to implement such a
> method? Thank you.
> 

There are two ways to approach this problem.  With the backend's 
statement_timeout config variable and the driver's Statement.cancel() 
method.  The issue with both of these is that you need to be concerned 
about thread safety and only cancelling the correct statement.

Using the backend's statement_timeout is pretty straightforward, before
each query set it and after each query reset it.  Issues to be careful of
are making sure the timeout gets reset on errors.  I would also be 
concerned about the potential overhead of issuing two additional queries 
for each user level statement execution.

With the Statement.cancel approach you would create a new thread to wake 
up and issue the cancel if the statement hasn't completed yet, but I 
believe there are some race conditions that make it difficult to do this 
correctly:

http://archives.postgresql.org/pgsql-jdbc/2003-11/msg00148.php
http://archives.postgresql.org/pgsql-jdbc/2003-09/msg00175.php

Kris Jurka



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* setQueryTimeout
@ 2009-07-06 00:55  Jamie D <jackelofnar@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jamie D @ 2009-07-06 00:55 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

Is there any plans to implement setQueryTimeout on the 8.4 JDBC
driver?

Our application uses this statement and is forcing us to use 8.2
driver with Postgresql 8.4.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: setQueryTimeout
@ 2009-07-07 14:52  User <user2037@ymail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: User @ 2009-07-07 14:52 UTC (permalink / raw)
  To: pgsql-jdbc


According to my tests the 8.2 driver does not actually enforce the "setQueryTimeout" value regardless of which version of Postgresql is used on the back-end.

The new "socketTimeout" connection option may be used as a kind of 'global' query time-out as it applies to all queries for the connection. However, it is based on socket time-out yet must be caught as a PSQLException or Exception.

Regardless, "setQueryTimeout" enforcement would really help with some enterprise applications which need to enforce real-time constraints.

--- On Mon, 7/6/09, Jamie D <jackelofnar@gmail.com> wrote:

> From: Jamie D <jackelofnar@gmail.com>
> Subject: [JDBC] setQueryTimeout
> To: pgsql-jdbc@postgresql.org
> Date: Monday, July 6, 2009, 12:55 AM
> Hi,
> 
> Is there any plans to implement setQueryTimeout on the 8.4
> JDBC
> driver?
> 
> Our application uses this statement and is forcing us to
> use 8.2
> driver with Postgresql 8.4.
> 
> -- 
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
> 


      




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-07-07 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-29 23:20 Re: setQueryTimeOut Kris Jurka <books@ejurka.com>
2009-07-06 00:55 setQueryTimeout Jamie D <jackelofnar@gmail.com>
2009-07-07 14:52 Re: setQueryTimeout User <user2037@ymail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox