public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Shaozhong SHI <[email protected]>
Cc: pgsql-sql <[email protected]>
Subject: Re: Can we set time exception?
Date: Thu, 13 Jul 2023 11:52:32 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwYVJpjs0Z-Fy3kbUYbg5tFWEK8Vi9cD_P3Gr-OiwPw9Aw@mail.gmail.com>
References: <CA+i5Jwb3MGNSrMFeNSg1FOW+JjHi5vSGRaYaW1A-BHCzGuPNWA@mail.gmail.com>
	<CAKFQuwYVJpjs0Z-Fy3kbUYbg5tFWEK8Vi9cD_P3Gr-OiwPw9Aw@mail.gmail.com>

"David G. Johnston" <[email protected]> writes:
> On Thu, Jul 13, 2023 at 7:46 AM Shaozhong SHI <[email protected]>
> 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






view thread (4+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Can we set time exception?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox