Re: query taking much longer since Postgres 8.4 upgrade

From: tv(at)fuzzy(dot)cz
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: tv(at)fuzzy(dot)cz, "Davenport, Julie" <jdavenport(at)ctcd(dot)edu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: query taking much longer since Postgres 8.4 upgrade
Date: 2011-03-21 17:04:03
Message-ID: edf1c0575ccbdb74bb93b2975acf10e6.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Mon, Mar 21, 2011 at 11:32 AM, <tv(at)fuzzy(dot)cz> wrote:
>>> Incredible!  Setting enable_nestloop off temporarily for the run of
>>> this
>>> script made it run in less than a minute (had been running in 10 or 11
>>> minutes).  I think you have found a solution for many of my slow
>>> running
>>> scripts that use these same type of joins.  Thanks again.
>>> Julie
>>
>> Nice. Can you post EXPLAIN ANALYZE again, so that we can see why this
>> plan
>> was evaluated as as more expensive before disabling nested loops?
>
> well the problem is obvious -- the planner is estimating ~ 250 loops,
> when it in fact has to do ~ 60k. That's a two orders of magnitude
> miss.

Yeah, you're right, although I think the estimate is 1 loop vs. 2882 loops
in reality. The 250 vs. 60k is related to the result set.

Tomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jon Smark 2011-03-21 17:43:56 Passing a table as parameter
Previous Message Selena Deckelmann 2011-03-21 16:57:05 Re: foreign data wrappers