Re: estimated rows vs. actual rows

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: estimated rows vs. actual rows
Дата
Msg-id 200502131341.09811.josh@agliodbs.com
обсуждение исходный текст
Ответ на estimated rows vs. actual rows  (Jaime Casanova <systemguards@gmail.com>)
Ответы Re: estimated rows vs. actual rows  (Jaime Casanova <systemguards@gmail.com>)
Список pgsql-performance
Jaime,

> Why is this query using a seq scan rather than a index scan?

Because it thinks a seq scan will be faster.

> i notice
> the diff between the estimated rows and actual rows (almost 2000).

Yes, ANALYZE, and possibly increasing the column stats, should help that.

> Can this affect the query plan? i think this is a problem of
> statistics, am i right? if so, what can be done?

Well, if the estimate was accurate, PG would be even *more* likely to use a
seq scan (more rows).

I think maybe you should establish whether a seq scan actually *is* faster?
Perhaps do SET enable_seqscan = false and then re-run the query a few times?

--
Josh Berkus
Aglio Database Solutions
San Francisco

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

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: estimated rows vs. actual rows
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: estimated rows vs. actual rows