Re: EXPLAIN time difference in real - Mailing list pgsql-admin

From Tom Lane
Subject Re: EXPLAIN time difference in real
Date
Msg-id 18171.1398613389@sss.pgh.pa.us
Whole thread Raw
In response to Re: EXPLAIN time difference in real  (Michael Monnerie <lists.michael.monnerie@is.it-management.at>)
List pgsql-admin
Michael Monnerie <lists.michael.monnerie@is.it-management.at> writes:
> Am 26.04.2014 20:27, schrieb Tom Lane:
>> Could the planning time possibly account for that? How long does a
>> plain EXPLAIN of the same query take? regards, tom lane

> But I see lots of log entries with this query, all around 1200ms. That's
> why I started investigating:

Hmm ... that leads to a different idea: maybe you have got some other
operation that is (repeatedly) holding an exclusive lock on one of these
tables for about 1200ms?  The time needed to acquire AccessShareLock on
a table being selected from is spent in the parser, so that wouldn't be
accounted for either by EXPLAIN's total runtime.

That theory isn't totally satisfying because you wouldn't expect unrelated
processes to all suffer the same wait time, but it's worth eliminating
lock waits as a factor in this.  Try turning on log_lock_waits with a
threshold of a few hundred ms.

> Here's the EXPLAIN w/o ANALYZE (exactly the same):

This output doesn't answer my question, which is how long did the EXPLAIN
command take?  You could run it with psql's \timing turned on.

> PS: Is there anything I could possibly optimize in that query by another
> index? I don't see anything obvious.

Optimization isn't the problem here: whatever is delaying these queries is
happening outside execution proper.

            regards, tom lane


pgsql-admin by date:

Previous
From: Michael Monnerie
Date:
Subject: Re: EXPLAIN time difference in real
Next
From: Jim Mercer
Date:
Subject: Re: