Re: Missing query plan for auto_explain. - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Missing query plan for auto_explain.
Date
Msg-id 20220830111643.oj3cnolt3hjrxng6@alvherre.pgsql
Whole thread Raw
In response to Missing query plan for auto_explain.  (Matheus Martin <matheus.martin@voidbridge.com>)
Responses Re: Missing query plan for auto_explain.
Re: Missing query plan for auto_explain.
List pgsql-general
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 by date:

Previous
From: Matheus Martin
Date:
Subject: Missing query plan for auto_explain.
Next
From: Julien Rouhaud
Date:
Subject: Re: Missing query plan for auto_explain.