Re: [PERFORM] Inaccurate Explain Cost - Mailing list pgsql-general

From Matthias
Subject Re: [PERFORM] Inaccurate Explain Cost
Date
Msg-id op.wlaiyyw50uf2nk@nitrogenycs3
Whole thread Raw
In response to Re: [PERFORM] Inaccurate Explain Cost  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
Am 27.09.2012, 02:04 Uhr, schrieb Jeff Janes <jeff.janes@gmail.com>:

> On Wed, Sep 26, 2012 at 1:21 PM, hubert depesz lubaczewski
> <depesz@depesz.com> wrote:
>> On Wed, Sep 26, 2012 at 02:38:09PM -0400, Robert Sosinski wrote:
>>> The first query shows a cost of 190,169.55 and runs in 199,806.951 ms.
>>> When I disable nested loop, I get a cost of 2,535,992.34 which runs in
>>> only 133,447.790 ms.  We have run queries on our database with a cost
>>> of 200K cost before and they ran less then a few seconds, which makes
>>> me wonder if the first query plan is inaccurate.  The other issue is
>>> understanding why a query plan with a much higher cost is taking less
>>> time to run.
>>
>> Are you under impression that cost should be somehow related to actual
>> time?
>
> I am certainly under that impression.  If the estimated cost has
> nothing to do with run time, then what is it that the cost-based
> optimizer is trying to optimize?

See http://www.postgresql.org/docs/9.2/static/runtime-config-query.html
section "18.7.2. Planner Cost Constants".

-Matthias


pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: Re: Need help in reclaiming disk space by deleting the selected records
Next
From: "Albe Laurenz"
Date:
Subject: Re: unc paths, like and backslashes on 8.4