[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: Can we set time exception?
From:       Tom Lane <tgl () sss ! pgh ! pa ! us>
Date:       2023-07-13 15:52:32
Message-ID: 2884749.1689263552 () sss ! pgh ! pa ! us
[Download RAW message or body]

"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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic