Re: Unexpected sequence scan

От: Tom Lane
Тема: Re: Unexpected sequence scan
Дата: ,
Msg-id: 5025.1336142599@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Unexpected sequence scan  (Dan Fairs)
Ответы: Re: Unexpected sequence scan  (Dan Fairs)
Список: pgsql-performance

Скрыть дерево обсуждения

Unexpected sequence scan  (Dan Fairs, )
 Re: Unexpected sequence scan  ("Kevin Grittner", )
 Re: Unexpected sequence scan  (Tom Lane, )
  Re: Unexpected sequence scan  (Dan Fairs, )

Dan Fairs <> writes:

> I have a query which is running slowly, and the query plan shows an
unexpected sequence scan where I'd have expected the planner to use an
index. Setting enable_seqscan=off causes the planner to use the index as
expected.

That hashjoin plan doesn't look at all unreasonable to me.  The fact
that it actually comes out a lot slower than the nestloop with inner
indexscan suggests that you must be running with the large table
completely cached in RAM.  If that's the normal state of affairs for your
database, you should consider decreasing the random_page_cost setting
so that the planner will plan appropriately.

            regards, tom lane


В списке pgsql-performance по дате сообщения:

От: Richard Jones
Дата:
Сообщение: Re: Partitioned/inherited tables with check constraints causing slower query plans
От: Martin Grotzke
Дата:
Сообщение: Re: Several optimization options (config/hardware)