Re: sorting problem
От | Tom Lane |
---|---|
Тема | Re: sorting problem |
Дата | |
Msg-id | 20873.1103303665@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: sorting problem (Bruno Wolff III <bruno@wolff.to>) |
Ответы |
Re: sorting problem
|
Список | pgsql-general |
Bruno Wolff III <bruno@wolff.to> writes: > Greg Stark <gsstark@mit.edu> wrote: >> where postgres won't bother with the index since it will be slower than just >> resorting the entire table. > Using an index to do an order by is an order N operation. Doing a sort > is an order N log N operation. For large values of N, a index will be > faster. Unfortunately not ... the constant factors are such that the index solution isn't very competitive at large N, unless the table is already well ordered (ie clustered). The sort code is a lot better at avoiding random-seeks-all-over-the-disk syndrome. I suppose your argument is good as N goes to infinity, but for real-world cases we don't seem to reach the asymptotic regime. regards, tom lane
В списке pgsql-general по дате отправления: