Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Inaccurate Explain Cost

From: Matthias <nitrogenycs(at)gmail(dot)com>
To: depesz(at)depesz(dot)com, "Jeff Janes" <jeff(dot)janes(at)gmail(dot)com>
Cc: "Robert Sosinski" <rsosinski(at)ticketevolution(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org, "Spike Grobstein" <spike(at)ticketevolution(dot)com>
Subject: Re: [GENERAL] Inaccurate Explain Cost
Date: 2012-09-27 10:48:24
Message-ID: op.wlaiyyw50uf2nk@nitrogenycs3 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-performance
Am 27.09.2012, 02:04 Uhr, schrieb Jeff Janes <jeff(dot)janes(at)gmail(dot)com>:

> On Wed, Sep 26, 2012 at 1:21 PM, hubert depesz lubaczewski
> <depesz(at)depesz(dot)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


In response to

pgsql-performance by date

Next:From: M. D.Date: 2012-09-27 19:11:24
Subject: hardware advice
Previous:From: Undertaker RudeDate: 2012-09-27 09:01:48
Subject: Re: Same query doing slow then quick

pgsql-general by date

Next:From: Albe LaurenzDate: 2012-09-27 10:51:16
Subject: Re: unc paths, like and backslashes on 8.4
Previous:From: Albe LaurenzDate: 2012-09-27 10:39:15
Subject: Re: Re: Need help in reclaiming disk space by deleting the selected records

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group