Re: sorting problem

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: sorting problem
Дата
Msg-id 20041217142613.GA21935@wolff.to
обсуждение исходный текст
Ответ на Re: sorting problem  (Greg Stark <gsstark@mit.edu>)
Ответы Re: sorting problem
Re: sorting problem
Список pgsql-general
On Thu, Dec 16, 2004 at 23:33:00 -0500,
  Greg Stark <gsstark@mit.edu> wrote:
>
> Chris Smith <chris@interspire.com> writes:
>
> > Would doing it this way require an index:
> >
> > create index lower_lastname on table x lower(lastname);
>
> Well it doesn't *require* but it may be a good idea. It depends on your
> queries. It will NOT be useful for a query like:
>
> select * from x order by lower(lastname)
>
> where postgres won't bother with the index since it will be slower than just
> resorting the entire table. The way this index is useful is if you have
> queries of the form:

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. The index will slow down write operations, so it may still be
a bad idea in some cases.

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

Предыдущее
От: "Florian G. Pflug"
Дата:
Сообщение: Re: analyze-error: "cannot compare arrays of different
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: What HW / OS is recommeded