Re: Can we set time exception? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Can we set time exception?
Date
Msg-id 2884749.1689263552@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can we set time exception?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-sql
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, Jul 13, 2023 at 7:46 AM Shaozhong SHI <shishaozhong@gmail.com>
> wrote:
>> Can we set a time exception?
>> If the function responds with result in a given time, we take the result.
>> If the response of the function exceeds the time set, skip it.

> No.  Function execution happens on a single thread (i.e., synchronous) in a
> stacked manner.  There is no way for the caller to get processing control
> back other than the callee returning.

You could do something with statement_timeout, but the recovery would
have to be managed on the client (application) side.  IIRC we measure
that as the total time to finish a client query, not the time of any
one statement within a function or DO block.

            regards, tom lane



pgsql-sql by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Can we set time exception?
Next
From: Shaozhong SHI
Date:
Subject: Memory allocation error