PQexec and timeouts

Started by Medi Montaseriover 23 years ago3 messagesgeneral
Jump to latest
#1Medi Montaseri
medi.montaseri@intransa.com

Is there any configuration parameter (run time or compile time) that would
allow me to timeout from a query.....

ie, say I make a query (select or delete or whatever) against the
backend which
is using some disk off of a networked storage (NAS, SAN, etc)...

I need to timeout if the resource (disk or the network) is wedged...

If not, then what if I implement it using
PQsendQuery()
select on the connection socket with some timeout
if you haven't gotton your answer, abort the query...

What is the best way to abort the query...I know of

PQfinish() # too expensive, it closes the TCP connection
PQreset() # not sure but almost as expensive as PQfinish()
PQrequestCancel() # this sounds good...

Thanks

#2Bruce Momjian
bruce@momjian.us
In reply to: Medi Montaseri (#1)
Re: PQexec and timeouts

Have you seen 'statement_timeout" SET parameter in 7.3?

---------------------------------------------------------------------------

Medi Montaseri wrote:

Is there any configuration parameter (run time or compile time) that would
allow me to timeout from a query.....

ie, say I make a query (select or delete or whatever) against the
backend which
is using some disk off of a networked storage (NAS, SAN, etc)...

I need to timeout if the resource (disk or the network) is wedged...

If not, then what if I implement it using
PQsendQuery()
select on the connection socket with some timeout
if you haven't gotton your answer, abort the query...

What is the best way to abort the query...I know of

PQfinish() # too expensive, it closes the TCP connection
PQreset() # not sure but almost as expensive as PQfinish()
PQrequestCancel() # this sounds good...

Thanks

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Medi Montaseri
medi.montaseri@intransa.com
In reply to: Bruce Momjian (#2)
Re: PQexec and timeouts

Ahaa....that is good....keep it comming....

Bruce Momjian wrote:

Show quoted text

Have you seen 'statement_timeout" SET parameter in 7.3?

---------------------------------------------------------------------------

Medi Montaseri wrote:

Is there any configuration parameter (run time or compile time) that would
allow me to timeout from a query.....

ie, say I make a query (select or delete or whatever) against the
backend which
is using some disk off of a networked storage (NAS, SAN, etc)...

I need to timeout if the resource (disk or the network) is wedged...

If not, then what if I implement it using
PQsendQuery()
select on the connection socket with some timeout
if you haven't gotton your answer, abort the query...

What is the best way to abort the query...I know of

PQfinish() # too expensive, it closes the TCP connection
PQreset() # not sure but almost as expensive as PQfinish()
PQrequestCancel() # this sounds good...

Thanks

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly