Check explain plan of a running query in other session

Поиск
Список
Период
Сортировка
От Jonas Gassenmeyer
Тема Check explain plan of a running query in other session
Дата
Msg-id CADH0_2V5NkwpqKA5GoFq_FNd01CY6zPcNam6jdvrf0H58K16-A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Check explain plan of a running query in other session  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: Check explain plan of a running query in other session  (Rafia Sabih <rafia.pghackers@gmail.com>)
Список pgsql-novice
Hello,

I am asking myself for a while if there is an easy option (via dictionary views like pg_stat_activity or similar) to check what execution plan was chosen for a long running SQL statement while it is running in a different session?
I have a performance problem in a plpgsql procedure that executes an update within a loop. My guess is that it chose a generic plan instead of bind peeking and then does not use an index.

I am not able to proof my theory, since I don't know how to get the explain plan for it.
For me the easiest would be to check the running statement in a different session and "hook into" the other plpgsql session to check what the optimizer chose.

Is that something I can do easily? If not: What is the PostgreSQL way of doing it?

Danke und viele Grüße
Jonas

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Specified date type but created column is timestamp without time zone
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Check explain plan of a running query in other session