| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
| Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: strange explain |
| Date: | 2002-05-13 17:10:23 |
| Message-ID: | 10821.1021309823@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joel Burton | 2002-05-13 18:43:09 | Re: TRUNCATE |
| Previous Message | Oleg Bartunov | 2002-05-13 16:30:17 | Re: strange explain |