| От | Tom Lane |
|---|---|
| Тема | Re: [SQL] "Group by" and "index". |
| Дата | |
| Msg-id | 497.949271381@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | "Group by" and "index". ("Vlad Marchenko" <vlad@infonet.com.ua>) |
| Список | pgsql-sql |
"Vlad Marchenko" <vlad@infonet.com.ua> writes:
>> explain select field1 from test group by field1;
> It don't use this index :-(.
That's a deficiency of the 6.5 planner; it won't consider an indexscan
unless there's a WHERE clause that matches the index. This is fixed for
7.0.
However, the 6.5 planner is not necessarily doing the wrong thing here!
Replacing the explicit sort with an index scan could easily produce a
slower query. Index scans are good for pulling out a few items,
but when you are going to end up fetching the whole table, they are
pretty slow because of the nonsequential disk accesses they cause.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера