Re: Can Postgres use an INDEX over an OR?

Поиск
Список
Период
Сортировка
От Robert James
Тема Re: Can Postgres use an INDEX over an OR?
Дата
Msg-id e09785e00907200625i45a7cb19l334d66493a0ed188@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Can Postgres use an INDEX over an OR?  (Chris <dmagick@gmail.com>)
Список pgsql-performance
Query is:
select * from dict
where 
 word in (select substr('moon', 0, generate_series(3,length('moon')))) -- this is my X above
 OR word like 'moon%' -- this is my Y above

dict is indexed on word
2009/7/20 Chris <dmagick@gmail.com>
2009/7/20 Robert James <srobertjames@gmail.com <mailto:srobertjames@gmail.com>>



   Hi. I notice that when I do a WHERE x, Postgres uses an index, and
   when I do WHERE y, it does so as well, but when I do WHERE x OR y,
   it doesn't. Why is this so?

What Robert didn't post was his query, see

http://archives.postgresql.org/pgsql-general/2009-07/msg00767.php

which makes it a lot harder to 'optimize' since they aren't straight forward conditions.

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

Предыдущее
От: Robert James
Дата:
Сообщение: Re: Fastest char datatype
Следующее
От: Віталій Тимчишин
Дата:
Сообщение: Re: Can Postgres use an INDEX over an OR?