Re: Order by optimisations?

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Order by optimisations?
Дата
Msg-id 42D72227.5050607@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: Order by optimisations?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Order by optimisations?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>>>Does it know that the input to the sort routine is already sorted and 
>>>hence is a no-op?
> 
>>Yes
> 
> No, but in most cases this will use an index and hence will assume that
> the index is responsible for ordering.

OK, so what's going on here?

usa=> explain select * from users_myfoods_map where user_id=1 and 
date='2003-11-03' order by date;                                                    QUERY PLAN 

-------------------------------------------------------------------------------------------------------------------
Sort (cost=4.84..4.85 rows=2 width=22)   Sort Key: date   ->  Index Scan using users_myfoods_map_user_id_date_key on 
 
users_myfoods_map  (cost=0.00..4.83 rows=2 width=22)         Index Cond: ((user_id = 1) AND (date =
'2003-11-03'::date))
(4 rows)

(That's on our enormous live table)

Chris



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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Order by optimisations?
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Simplifying identification of temporary tables