Re: Order by optimisations?

Поиск
Список
Период
Сортировка
Искать
От
Christopher Kings-Lynne
Тема
Re: Order by optimisations?
Дата
Msg-id
42D74CCE.3030609@familyhealth.com.au
Ответ на
Список
Дерево обсуждения
Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Order by optimisations? Hannu Krosing <hannu@skype.net>
Re: Order by optimisations? Tom Lane <tgl@sss.pgh.pa.us>
Re: Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Order by optimisations? Tom Lane <tgl@sss.pgh.pa.us>
Re: Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Order by optimisations? "Andrew Dunstan" <andrew@dunslane.net>
Re: Order by optimisations? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
> Well, date evidently isn't the high-order key of this index.  But why
> exactly are you worried about a sort of 2 rows?

Aha that's nailed it:

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

------------------------------------------------------------------------------------------------------------- Index Scan using users_myfoods_map_user_id_date_key on 
users_myfoods_map  (cost=0.00..3.78 rows=1 width=22)   Index Cond: ((user_id = 1) AND (date >= '2003-11-03'::date) AND 
(date <= '2003-11-03'::date))
(2 rows)


I don't care about this particular result.  But imagine it running 
thousands of times a minute, with result sets between 0 and 50 rows...

Chris


В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: Order by optimisations?
От: Christopher Kings-Lynne
Дата:
Сообщение: pg_get_prepared?
FAQ