Re: Query not using the indexes properly.

Поиск
Список
Период
Сортировка
От David Wilson
Тема Re: Query not using the indexes properly.
Дата
Msg-id e7f9235d0910011918s575cdd70mca1ea1fa61a7c5e1@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query not using the indexes properly.  (Chris <dmagick@gmail.com>)
Ответы Re: Query not using the indexes properly.
Список pgsql-general


On Thu, Oct 1, 2009 at 10:04 PM, Chris <dmagick@gmail.com> wrote:
Tim Uckun wrote:

If this is a common query you could probably do a multi-column index on all 3 columns (id, company_id, source_model_name) - but if company_id and source_model_name have a low number of distinct values, then it's not going to help.

If you try the multi-column index (which is a good idea), be sure that "id" is the last of the three columns, since that's the column on which you have an inequality test rather than an equality test; eg, (company_id,source_model_name,id).

--
- David T. Wilson
david.t.wilson@gmail.com

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

Предыдущее
От: Chris
Дата:
Сообщение: Re: Query not using the indexes properly.
Следующее
От: Tim Uckun
Дата:
Сообщение: Re: Query not using the indexes properly.