"Gary Doades" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to