Re: setting query timeout as part of the query
| От | Tom Lane |
|---|---|
| Тема | Re: setting query timeout as part of the query |
| Дата | |
| Msg-id | 20756.1412110415@sss.pgh.pa.us обсуждение |
| Ответ на | Re: setting query timeout as part of the query (Steve Crawford <scrawford@pinpointresearch.com>) |
| Ответы |
Re: setting query timeout as part of the query
Re: setting query timeout as part of the query |
| Список | pgsql-novice |
Steve Crawford <scrawford@pinpointresearch.com> writes:
> On 09/30/2014 12:52 PM, William Morgan wrote:
>> My question is: is there a way to set this timeout as part of the
>> query itself?
> You could probably write a function that includes your timeout setting
> and call that but I'm not sure that would be better than simply using a
> transaction.
IIRC, statement_timeout applies to the total time required to execute
a *command submitted by the client*, and the active value is determined
just before starting each command. So you're pretty much stuck: you
must issue the SET as a separate client-submitted command.
As Steve says, it should be possible to ensure that the pooler doesn't
take the session away from you in between, by wrapping the whole thing
in BEGIN/COMMIT if nothing else. If the pooler will take away a session
intra-transaction, it is 100% broken and dangerous, and you need to get
another one.
regards, tom lane
В списке pgsql-novice по дате отправления: