From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Odd planner choice? |
Date: | 2004-10-08 20:04:42 |
Message-ID: | 15493.1097265882@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
"Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk> writes:
> If I remove the redundant clauses, the planner now estimates 1000 rows returned from
> the table, not unreasonable since it has no statistics. But *why* in that case, with *more*
> estimated rows does it choose to materialize that table (26 rows) 573416 times!!!
It isn't. It's materializing that once and scanning it 573416 times,
once for each row in the outer relation. And this is not a bad plan
given the estimates. If it had stuck to what you call the good plan,
and there *had* been 1000 rows in the temp table, that plan would have
run 1000 times longer than it did.
As a general rule, if your complaint is that you get a bad plan for an
unanalyzed table, the response is going to be "so analyze the table".
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Gary Doades | 2004-10-08 20:29:57 | Re: Odd planner choice? |
Previous Message | Gary Doades | 2004-10-08 19:46:03 | Re: Odd planner choice? |