Re: Help w/speeding up range queries?

Поиск
Список
Период
Сортировка
От Marcin Mank
Тема Re: Help w/speeding up range queries?
Дата
Msg-id 05e401c6fe6d$56d13780$0c67a8c0@maniek
обсуждение исходный текст
Ответ на Help w/speeding up range queries?  (John Major <major@cbio.mskcc.org>)
Список pgsql-performance
> Ie:  select FeatureID from SIMPLE_TABLE where FeatureChromosomeName like
> 'chrX' and StartPosition > 1000500 and EndPosition < 2000000;

How about ( this assumes that StartPosition <= EndPosition ):

select FeatureID
from SIMPLE_TABLE
where FeatureChromosomeName llike 'chrX'
and StartPosition > 1000500
and StartPosition < 2000000
and EndPosition > 1000500
and EndPosition < 2000000;


This at least should help the planner with estimating number of rows.

Also think twice when You assume that a query with ILIKE will use an index.
Read about varchar_pattern_ops.
Make an index on (FeatureChromosomeName,StartPosition) , and all should be
fine.

Greetings
Marcin


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

Предыдущее
От: "Simon Riggs"
Дата:
Сообщение: Re: Database-wide vacuum can take a long time, duringwhich tables are not being analyzed
Следующее
От: "Simon Riggs"
Дата:
Сообщение: Re: Help w/speeding up range queries?