optimizing "between" queries

Поиск
Список
Период
Сортировка
От Kyle
Тема optimizing "between" queries
Дата
Msg-id 14956.38621.306933.780332@ip146.usw5.rb1.bel.nwlink.com
обсуждение исходный текст
Ответы Re: optimizing "between" queries
Список pgsql-general
I have a table where I need to select elements that are between
certain values.  The typical query would be like:

  select foo from bar where
       element1 between ? and ? and  -- using some val_1a and val_1b
       element2 between ? and ? and  -- using some val_2a and val_2b
       ...
       element30 between ? and ?;

ie- we've got 30 elements here.  The runtime is acceptable now with
10k rows in the table (about 0.04 seconds).  However, the table size
will grow to the milions in the near future.

The data for element1..30 are int2's and columns element1..element30
have been ordered by how well they discriminate.  Can I use "cluster"
on more than one column with indexes per column to improve the search
time?  How else might I be able to tweak this?

thanks,
Kyle



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

Предыдущее
От: Héctor Balanzar
Дата:
Сообщение: Changing pgsql error messages...
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Arrays advanced usage