Re: Inaccurate Explain Cost

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Robert Sosinski <rsosinski(at)ticketevolution(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org, Spike Grobstein <spike(at)ticketevolution(dot)com>
Subject: Re: Inaccurate Explain Cost
Date: 2012-09-26 20:21:40
Message-ID: 20120926202140.GB10681@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

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?
If yes - that's not true, and afaik never was.
the fact that you got similar time and cost is just a coincidence.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Reichstadt 2012-09-26 20:28:08 SELECT …. WHERE id is in pool of ids of subquery……
Previous Message Edson Richter 2012-09-26 20:20:01 Re: [PERFORM] Inaccurate Explain Cost

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2012-09-26 20:55:00 Re: [GENERAL] Memory issues
Previous Message Edson Richter 2012-09-26 20:20:01 Re: [PERFORM] Inaccurate Explain Cost