Re: strange explain

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: strange explain
Дата
Msg-id 10821.1021309823@sss.pgh.pa.us
обсуждение исходный текст
Ответ на strange explain  (Oleg Bartunov <oleg@sai.msu.su>)
Список pgsql-hackers
Oleg Bartunov <oleg@sai.msu.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: mlw
Дата:
Сообщение: Re: pgaccess - the discussion is over
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: strange explain