Joost Kraaijeveld <J.Kraaijeveld@xxxxxxxxxx> writes: > On Wed, 2006-12-06 at 14:48 -0500, Tom Lane wrote: >> Joost Kraaijeveld <J.Kraaijeveld@xxxxxxxxxx> 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