Re: how to change the index chosen in plan?

Поиск
Список
Период
Сортировка
От Rural Hunter
Тема Re: how to change the index chosen in plan?
Дата
Msg-id 4FD20AD0.3040902@gmail.com
обсуждение исходный текст
Ответ на Re: how to change the index chosen in plan?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: how to change the index chosen in plan?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-performance
No, it's not the analyze problem. For some other values on b.bid such
as 9, 10, the plan is fine since there a a lot of rows in table b for
them. But for some specific values such as 8 I want the plan changed.

于2012年6月8日 22:10:58,Tom Lane写到:
> Rural Hunter <ruralhunter@gmail.com> writes:
>> I have a query like this:
>> select a.* from a inner join b on a.aid=b.aid where a.col1=33 a.col2=44
>> and b.bid=8
>> postgresql selected the index on a.col1 then selected the index on
>> b.bid. But in my situation, I know that the query will be faster if it
>> chose the index on b.bid first since there are only a few rows with
>> value 8.
>
> If you know that and the planner doesn't, maybe ANALYZE is called for.
>
>             regards, tom lane
>



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: how to change the index chosen in plan?
Следующее
От: Cédric Villemain
Дата:
Сообщение: Re: non index use on LIKE on a non pattern string