| От | Simon Riggs |
|---|---|
| Тема | Re: BUG #3979: SELECT DISTINCT slow even on indexed column |
| Дата | |
| Msg-id | 1203934747.4252.10.camel@ebony.site обсуждение исходный текст |
| Ответ на | BUG #3979: SELECT DISTINCT slow even on indexed column ("David Lee" <david_lee@bigfix.com>) |
| Список | pgsql-bugs |
On Thu, 2008-02-21 at 23:34 +0000, David Lee wrote: > I ran EXPLAIN and it showed that the path did not use the index, so I ran: Your expectation that this would use an index is unfortunately not correct. We need to check visibility on the table rows to do the query. We choose to do this by doing a sort and then a unique operation. That's the most efficient plan when there are potentially many unique values. In the case you mention it would be faster for us to skip through the index retrieving at most one row from each value in the index. We don't currently do that, but we could. However that plan would be restricted only to queries of the form SELECT DISTINCT column-list-of-index FROM table; so its probably not going to be optimised anytime soon. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера