Re: Missing query plan for auto_explain.

Поиск
Список
Период
Сортировка
Искать
От
Julien Rouhaud
Тема
Re: Missing query plan for auto_explain.
Дата
Msg-id
20220830123053.s5ypjyhsnao2pimb@jrouhaud
Ответ на
Список
Дерево обсуждения
Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: Missing query plan for auto_explain. Julien Rouhaud <rjuju123@gmail.com>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: Missing query plan for auto_explain. Tom Lane <tgl@sss.pgh.pa.us>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Julien Rouhaud <rjuju123@gmail.com>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Maxim Boguk <maxim.boguk@gmail.com>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Maxim Boguk <maxim.boguk@gmail.com>
Re: Missing query plan for auto_explain. Matheus Martin <matheus.martin@voidbridge.com>
Re: Missing query plan for auto_explain. Julien Rouhaud <rjuju123@gmail.com>
Hi,

On Tue, Aug 30, 2022 at 01:16:43PM +0200, Alvaro Herrera 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?)

AFAICS log_min_duration_statements threshold is based on the full query
processing time while auto_explain is only based on the executor runtime, so
one more likely explanation is that out of the 1423ms, more than 423ms were
spent in the planner?


В списке pgsql-general по дате отправления
От: Alvaro Herrera
Дата:
От: Matheus Martin
Дата:
FAQ