Re: How Do You Associate a Query With its Invoking Procedure?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How Do You Associate a Query With its Invoking Procedure?
Дата
Msg-id CAKFQuwYRpgK8ZZWDd5rnGadbnL721W8wt_UouY99-JvGs2pTKw@mail.gmail.com
обсуждение исходный текст
Ответ на How Do You Associate a Query With its Invoking Procedure?  (Fd Habash <fmhabash@gmail.com>)
Ответы Re: How Do You Associate a Query With its Invoking Procedure?  (Rick Otten <rottenwindfish@gmail.com>)
Список pgsql-performance
On Thu, Sep 13, 2018 at 12:49 PM, Fd Habash <fmhabash@gmail.com> wrote:

In API function may invoke 10 queries. Ideally, I would like to know what queries are invoked by it and how long each took.

 

I’m using pg_stat_statement. I can see the API function statement, but how do I deterministically identify all queries invoked by it?


pg_stat_statement is a global tracker that throws away execution context, in this case the process id, needed to track the level of detail you desire.  I think the best you can do is log all statements and durations to the log file and parse that.

For the "what queries are invoked by it" you can just read the source code...

As there is no canned solution to provide the answer you seek the final solution you come up with will be influenced by your access patterns, specific needs, and (in)ability to write C code (though maybe there is an extension out there you could leverage...).

David J.

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

Предыдущее
От: Fred Habash
Дата:
Сообщение: Re: How Do You Associate a Query With its Invoking Procedure?
Следующее
От: Rick Otten
Дата:
Сообщение: Re: How Do You Associate a Query With its Invoking Procedure?