Re: Slow query-plan generation (fast query) PG 9.2

From: Jesper Krogh <jesper(at)krogh(dot)cc>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow query-plan generation (fast query) PG 9.2
Date: 2013-09-03 19:34:10
Message-ID: 522639B2.4010309@krogh.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 03/09/13 09:47, Craig Ringer wrote:
> On 09/03/2013 03:46 PM, jesper(at)krogh(dot)cc wrote:
>> Hi.
>>
>> I have a strange situation where generating the query plan takes 6s+ and
>> executing it takes very little time.
> How do you determine that it's planning time at fault here?
Not that I'm sure, but the timing I send were only for "explain" not
"explain analyze". The database is constantly updating and at the moment
i cannot reproduce it any more. But at the time I picked the numbers it
were very reproducible.. (tried 10+ times over 15 minutes).

Please take separate timing for: PREPARE testq AS select table.id
from db.table left join db.tablepro on db.id = tablepro.table_id
where table.fts @@ to_tsquery('english','q12345') ; and then:
EXPLAIN ANALYZE EXECUTE testq;

I'll try to do that if i see the problem re-occour. I'm just very
interested in what explain then does if it is not only the time for the
query plan. When I did try the "PREPARE / EXECUTE" dance as you
described .. i didnt see the prepare state take time, which seems to be
consistent with that the planning time is in the EXECUTE step according
to the documentation.

--
Jesper

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2013-09-03 20:34:30 Re: COPY TO and VACUUM
Previous Message Kevin Grittner 2013-09-03 19:02:00 Re: planner parameters