Re: Why date index is not used

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: Why date index is not used
Дата
Msg-id e6bgd5$1vgk$3@news.hub.org
обсуждение исходный текст
Ответ на Why date index is not used  ("Andrus" <eetasoft@online.ee>)
Список pgsql-performance
Tom,

> Because it doesn't help --- the system still has to do the sort.

It can help a lot in this case.

kuupaev is sales date
kellaaeg is sales time

Postgres can use kuupaev index to fetch first 100 rows plus a number of more
rows whose kellaaeg value is equal to kellaaeg in 100 th row. I have 500
sales per day.
So it can fetch 600 rows using index on kuupaev column.

After that it can sort those 600 rows fast.
Currently it sorts blindly  all 54000 rows in table.

> You'd need a two-column index on both of the ORDER BY columns to avoid
> sorting.

Thank you. It works.

Andrus.



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

Предыдущее
От: "Andrus"
Дата:
Сообщение: Re: Why date index is not used
Следующее
От: "Domenico - Sal. F.lli Riva"
Дата:
Сообщение: pgsql_tmp and postgres settings