Re: Limit transaction lifetime

Поиск
Список
Период
Сортировка
От Andrei Zhidenkov
Тема Re: Limit transaction lifetime
Дата
Msg-id ED3B8A6F-1F2B-4833-B34E-5D99A050D9A6@n26.com
обсуждение исходный текст
Ответ на Re: Limit transaction lifetime  (Fabio Ugo Venchiarutti <f.venchiarutti@ocado.com>)
Ответы Re: Limit transaction lifetime
Список pgsql-general
> If it's a single command you're trying to limit `SET statement_timeout TO <whatever>` should do the trick.

This will set only statement timeout but won’t work for long transactions that contain a lot of short statements.

> If you want it based on the session's cumulative statement time, off the top of my head I can't think of anything in
vanillaPG without using executor hooks (that requires some coding). 

Yes, that’s exactly I want to do.

> If the queries that worry you are long-lived, you might be able to get by with a scheduled process checking against
pg_stat_activity(eg: age(query_start)) and adding the current query's run-time to some per-session total, but it's an
highlyinaccurate process. 

I think in my case I should check `xact_start`, because not every query initiates a new transaction.




В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: What do null column values for pg_stat_progress_vacuum mean?
Следующее
От: Fabio Ugo Venchiarutti
Дата:
Сообщение: Re: Limit transaction lifetime