Re: timeout implementation issues

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Jessica Perry Hekman <jphekman@dynamicdiagrams.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2002-04-01T16:22:21Z
Lists: pgsql-hackers
Jessica Perry Hekman wrote:
> > On Sat, 30 Mar 2002, Tom Lane wrote:
> > 
> > > Au contraire, it is not assuming anything.  It is sending off a cancel
> > > request and then waiting to see what happens.  Maybe the query will be
> 
> Okay, I see now: when processCancelRequest() is called, a return of 127 is
> sent. That would indeed work; thanks for walking me through it.
> 
> My other question was how to send the timeout value to the backend. Bruce
> said at one point:
> 
> > Timeout can be part of BEGIN, or a SET value, which would work from
> > jdbc.
> 
> I'm not sure how this would work. The timeout value would be sent as part
> of a SQL query?

I think there are two ways of making this capability visible to users. 
First, you could do:

	SET query_timeout = 5;
	
and all queries after that would time out at 5 seconds.  Another option
is:

	BEGIN WORK TIMEOUT 5;
	...
	COMMIT;

which would make the transaction timeout after 5 seconds.  We never
decided which one we wanted, or both.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026