Re: Missing query plan for auto_explain.

Поиск
Список
Период
Сортировка
От Matheus Martin
Тема Re: Missing query plan for auto_explain.
Дата
Msg-id CAB_m0bGp7kZJpZ4-fRswt4pXxLQgs3eykSCrorSdAK18T-viNw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Missing query plan for auto_explain.  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: Missing query plan for auto_explain.  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-general
Good idea on using an actual prepared statement but unfortunately it didn't produce any different result.

Could you please elaborate a bit on your advice concerning ExecutorEnd/PortalCleanup? I am afraid it doesn't mean much to me.

On Tue, 30 Aug 2022 at 12:16, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
On 2022-Aug-30, Matheus Martin wrote:

> Our Postgres recently started reporting considerably different
> execution times for the same query. When executed from our JDBC
> application the Postgres logs report an average execution time of 1500
> ms but when the query is manually executed through `psql` it doesn't
> take longer than 50 ms.

I don't know why the plan is not saved by auto_explain (maybe we're
missing ExecutorEnd calls somewhere?  that would be strange), but one
frequent reason for queries to show different plan in JDBC than psql is
the use of prepared statements.  Did you try using "PREPARE
yourquery(...)" and then EXPLAIN EXECUTE(...)?  Sometimes that helps to
recreate the original problem.


(Apparently, ExecutorEnd is called from PortalCleanup; what happens with
the portal for an extended-protocol query?)

--
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Missing query plan for auto_explain.
Следующее
От: Matheus Martin
Дата:
Сообщение: Re: Missing query plan for auto_explain.