Re: Order by optimisations?
От
Michael Paesold
Тема
Re: Order by optimisations?
Дата
Msg-id
012501c58856$fe0f0790$d501a8c0@zaphod
Список
Дерево обсуждения
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>
Christopher Kings-Lynne wrote: > Doesn't seem like it does: > > usatest=# explain select * from users_myfoods_map where date='2004-11-21' > order by date; > QUERY PLAN > --------------------------------------------------------------------------- > Sort (cost=17.17..17.48 rows=123 width=22) > Sort Key: date > -> Seq Scan on users_myfoods_map (cost=0.00..12.90 rows=123 width=22) > Filter: (date = '2004-11-21'::date) > (4 rows) > > The sort cost is non-zero. Or am I not looking at the right thing... You are looking at the right thing, AFAIK. Well, it seems the planner cannot reason that if a field should have only one value, sorting on that field is not needed. I remember there are examples where the planner will know that the input to a sort is already sorted and will skip the sort. Tom will be able to explain if this here is a reasonable optimization. I *guess* it could be done, with some restrictions. Best Regards, Michael Paesold
В списке pgsql-hackers по дате отправления