Nichlas =?iso-8859-1?Q?L=F6fdahl?= <[EMAIL PROTECTED]> writes: > My question is, why doesn't the planner pick the same plan for Q1 & Q3?
I think it's mostly that after you've added and ANALYZEd the "age" column, the planner has a pretty good idea of how many rows will pass the "age > 17 AND age < 20" condition. It can't do very much with the equivalent condition in the original form, though, and in fact ends up drastically underestimating the number of matching rows (86 vs reality of 3021). That leads directly to a bad plan choice :-( regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]