From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kenny Bachman <kenny.bachman17@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: too high planning time
Date: Thu, 02 Feb 2023 10:24:25 -0500
Message-ID: <1536295.1675351465@sss.pgh.pa.us> (raw)
In-Reply-To: <CAC0w7LKjDd16T80CYejmMrht1Ddjcf1P8jg1POdH=RyRxCHLXA@mail.gmail.com>
References: <CAC0w7LKjDd16T80CYejmMrht1Ddjcf1P8jg1POdH=RyRxCHLXA@mail.gmail.com>
Kenny Bachman <kenny.bachman17@gmail.com> writes:
> EXPLAIN ANALYZE select
> i."DefinitionId",
> from
> "T_WF_INSTANCE" i
> where
> i."InstanceId" = 10045683193;
> QUERY PLAN
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Index Scan using
> "T_WF_INSTANCE_InstanceId_ApplicationCd_EntityStatusCd_idx" on
> "T_WF_INSTANCE" i (cost=0.57..2.79 rows=1 width=34) (actual
> time=2.522..2.522 rows=1 loops=1)
> Index Cond: ("InstanceId" = '10045683193'::bigint)
> * Planning Time: 8460.446 ms Execution Time: 2.616 ms*
> (4 rows)
It's hard to believe that such a simple query could take that
long to plan. What I'm wondering is if the planner got blocked
on some other session's exclusive lock. Not a lock on
"T_WF_INSTANCE" itself, because we'd have got that lock during
parsing before the "Planning Time" measurement starts. But
there's going to be a physical access to the table's index
to determine its tree height, so an ex-lock on the index could
explain this. Or an ex-lock on catalogs, particularly pg_statistic.
What else is going on in your database when this happens?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, kenny.bachman17@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: too high planning time
In-Reply-To: <1536295.1675351465@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox