Re: Query planning question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query planning question
Дата
Msg-id 834.1242054368@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Query planning question  ("John Lister" <john.lister-ps@kickstone.com>)
Список pgsql-sql
"John Lister" <john.lister-ps@kickstone.com> writes:
> Am I right in assuming the planner thinks a sequential scan is quicker than 10k index hits, would tweaking the costs
fixthis or would i be better updating the stats for the product_id and manufacturer_id fields?
 

AFAICT the planner did exactly the right things here.  Your first
example is fetching 40 times as many rows from retailer_offer as
the second one is.  If the planner had stuck with the nestloop plan,
it would've taken about 40x as long, and been significantly slower
than the hash join.
        regards, tom lane


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Distinct oddity
Следующее
От: "John Lister"
Дата:
Сообщение: Re: Query planning question