max execution time of query

Started by S Arvindalmost 17 years ago5 messagesgeneral
Jump to latest
#1S Arvind
arvindwill@gmail.com

Is there any possibility to mention max time a query can execute from DBCP
side? our DB is Postgres and Container is tomcat 6. we dont want to give the
timeout in postgres for all query but need to set in application side based
on differnet needs? Is it possible?

Is there anyother way to specify the query execution time out while
establishing connection with the help of DBCP in tomcat?

Example, if a query executed from web application then it should not
execute more then 22mins. If it execute more then that means query shold be
cancelled from postgres(important) and java should get exception on this
event. Is it possible?

-Arvind S

*
"Many of lifes failure are people who did not realize how close they were to
success when they gave up."
-Thomas Edison*

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: S Arvind (#1)
Re: max execution time of query

In response to S Arvind :

Is there any possibility to mention max time a query can execute from DBCP
side? our DB is Postgres and Container is tomcat 6. we dont want to give the
timeout in postgres for all query but need to set in application side based on
differnet needs? Is it possible?

Is there anyother way to specify the query execution time out while
establishing connection with the help of DBCP in tomcat?

You can set statement_timeout per session, maybe you can do that within
your application.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

#3Chris
dmagick@gmail.com
In reply to: S Arvind (#1)
Re: max execution time of query

S Arvind wrote:

Is there any possibility to mention max time a query can execute from
DBCP side? our DB is Postgres and Container is tomcat 6. we dont want to
give the timeout in postgres for all query but need to set in
application side based on differnet needs? Is it possible?

Is there anyother way to specify the query execution time out while
establishing connection with the help of DBCP in tomcat?

Example, if a query executed from web application then it should not
execute more then 22mins. If it execute more then that means query shold
be cancelled from postgres(important) and java should get exception on
this event. Is it possible?

You can set statement_timeout per session.

http://www.postgresql.org/docs/8.3/static/runtime-config-client.html

Not sure what happens on the java side when the exec time is hit but the
query is cancelled in postgres.

--
Postgresql & php tutorials
http://www.designmagick.com/

#4S Arvind
arvindwill@gmail.com
In reply to: Chris (#3)
Re: max execution time of query

Thanks Chris & kretschmer. But one small doubt in it,, What happens to
update or insert query?

- Arvind S
*
"Many of lifes failure are people who did not realize how close they were to
success when they gave up."
-Thomas Edison
*

On Fri, Jun 5, 2009 at 11:59 AM, Chris <dmagick@gmail.com> wrote:

Show quoted text

S Arvind wrote:

Is there any possibility to mention max time a query can execute from DBCP
side? our DB is Postgres and Container is tomcat 6. we dont want to give the
timeout in postgres for all query but need to set in application side based
on differnet needs? Is it possible?

Is there anyother way to specify the query execution time out while
establishing connection with the help of DBCP in tomcat?

Example, if a query executed from web application then it should not
execute more then 22mins. If it execute more then that means query shold be
cancelled from postgres(important) and java should get exception on this
event. Is it possible?

You can set statement_timeout per session.

http://www.postgresql.org/docs/8.3/static/runtime-config-client.html

Not sure what happens on the java side when the exec time is hit but the
query is cancelled in postgres.

--
Postgresql & php tutorials
http://www.designmagick.com/

#5Chris
dmagick@gmail.com
In reply to: S Arvind (#4)
Re: max execution time of query

S Arvind wrote:

Thanks Chris & kretschmer. But one small doubt in it,, What happens to
update or insert query?

They will be rolled back.

--
Postgresql & php tutorials
http://www.designmagick.com/