Re: Understanding sequential versus index scans.
От
Tom Lane
Тема
Re: Understanding sequential versus index scans.
Дата
Msg-id
11961.1248047260@sss.pgh.pa.us
Ответ на
Understanding sequential versus index scans. (Robert James)
Список
Дерево обсуждения
Understanding sequential versus index scans. Robert James <srobertjames@gmail.com>
Re: Understanding sequential versus index scans. Tom Lane <tgl@sss.pgh.pa.us>
Re: Understanding sequential versus index scans. Robert James <srobertjames@gmail.com>
Re: Understanding sequential versus index scans. Scott Marlowe <scott.marlowe@gmail.com>
Re: Understanding sequential versus index scans. Robert James <srobertjames@gmail.com>
Re: Understanding sequential versus index scans. Greg Stark <gsstark@mit.edu>
Re: Understanding sequential versus index scans. Robert James <srobertjames@gmail.com>
Re: Understanding sequential versus index scans. John R Pierce <pierce@hogranch.com>
Re: Understanding sequential versus index scans. Robert James <srobertjames@gmail.com>
Re: Understanding sequential versus index scans. Greg Stark <gsstark@mit.edu>
Robert James writes:
> 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.
It can use indexes for OR conditions, but not for arbitrary OR
conditions...
> 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
... and that one is pretty arbitrary. You might have some luck with
using a UNION instead, viz
select * from dict where X
union all
select * from dict where Y
regards, tom lane
В списке pgsql-general по дате отправления