Re: Why does explain differ from explan analyze?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why does explain differ from explan analyze?
Date: 2006-12-07 15:20:29
Message-ID: 15272.1165504829@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl> writes:
> On Wed, 2006-12-06 at 14:48 -0500, Tom Lane wrote:
>> Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl> writes:
>>> I have a query that if I do "explain" shows an other plan than if I do
>>> "explain analyze" with that same query (immediately after the explain).
>>
>> Really? What PG version is this? Can you provide a self-contained
>> test case?

> Alas, no self contained test case, I do have the query, the "explain"
> and the "explain analyse" output. Sorry about the long text.

Well, the answer is that these aren't the same query. For instance
you've got a change in estimated rowcount for "cares":

> -> Seq Scan on cares "t1_$deliver_cares_care" (cost=0.00..152.40 rows=3010 width=128)
> Filter: ((workers_number = 1) AND ((status)::text <> 'S'::text))

> -> Index Scan using idx_cares7 on cares "t1_$deliver_cares_care" (cost=0.00..176.05 rows=5147 width=128) (actual time=0.111..8.450 rows=4425 loops=1)
> Filter: ((workers_number = 1) AND ((status)::text <> 'P'::text))

and other changes elsewhere, all apparently due to using slightly
different constraint values. That will (and should) affect the plan.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Evans 2006-12-07 15:22:52 Re: partition insert question
Previous Message andy rost 2006-12-07 14:54:22 pg_controldata output documentation