Re: Can we set time exception?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Can we set time exception?
Дата
Msg-id 2884749.1689263552@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Can we set time exception?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Can we set time exception?
Следующее
От: Shaozhong SHI
Дата:
Сообщение: Memory allocation error