Oleg Bartunov <[EMAIL PROTECTED]> writes: > What's the difference for planner between 2 queries ?
> tour=# explain analyze select * from tours where > ( operator_id in (2,3,4,5,7) and type_id = 2 ); > tour=# explain analyze select * from tours where > ( operator_id in (2,3,4,5,7) and type_id = 4 ) or > ( operator_id = 8 and type_id = 3); The first one's already in normal form and doesn't need any more flattening. I believe the system will consider a multiple indexscan on operator_idx for it, but probably the cost estimator is concluding that that's a loser compared to one indexscan using type_id = 2. Without any info on the selectivity of these conditions it's hard to say whether that's a correct choice or not. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly