Re: Index problems

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Index problems
Дата
Msg-id 20031203074800.T28610@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Index problems  (Ferdinand Smit <ferdinand@telegraafnet.nl>)
Список pgsql-admin
On Wed, 3 Dec 2003, Ferdinand Smit wrote:

> Hi,
>
> When trying to explain a developer of our organisation the reson why the index
> was'nt used, i was confused my self.
>
> The simple question is: Why does the analyzer only use the index when the

There are a fiew things going on:

First, the statistics are overestimating the number of matching rows (by
say a factor of 3 in the first query).  You may wish to increase the
statistics target (alter table test alter column r set statistics <n>)
for something greater than 10, try 20 or 100 and re-analyze the table and
see if that lowers the estimated costs for the index scan.

Second, it's also possible that on your system random_page_cost should be
lower than 4.  Lowering that value lowers the estimated cost for index
scans.

Finally, it's also possible that the table is reasonably grouped by values
of r but that the statistics aren't realizing that fact. What does the row
in pg_statistic for that column show?

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

Предыдущее
От: Ferdinand Smit
Дата:
Сообщение: Index problems
Следующее
От: Jack Coates
Дата:
Сообщение: tuning questions