Re: relationship of backend_start, query_start, state_change

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: relationship of backend_start, query_start, state_change
Дата
Msg-id CAKFQuwboVoOQXNrEeBW5fHC28x+nLVSrEJPkYivWw1gnPFoCVg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: relationship of backend_start, query_start, state_change  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Thu, Apr 23, 2020 at 9:55 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Apr 23, 2020 at 9:37 AM Si Chen <sichen@opensourcestrategies.com> wrote:
Hello,

I'm looking at my pg_stat_activity and trying to figure out what is causing some of these processes.  I'm using this query:

SELECT pid, wait_event, state_change, backend_start, xact_start, query_start, state_change - query_start, query from pg_stat_activity where datname= 'my_database' and state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled');



Including the "state" field should clear things up considerably.

 

Specifically, you are including multiple states but then don't look at which one is actually assigned.  You should be able to reason about a connection mainly from its state and not consider the query at all - it is a debugging aid only.

David J.

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

Предыдущее
От: Olivier Gautherot
Дата:
Сообщение: Re: relationship of backend_start, query_start, state_change
Следующее
От: Justin King
Дата:
Сообщение: walreceiver termination