Re: order by x DESC, y ASC indexing problem

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: order by x DESC, y ASC indexing problem
Дата
Msg-id web-1771021@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на order by x DESC, y ASC indexing problem  (Vincent-Olivier Arsenault <vincent@up4c.com>)
Ответы Re: order by x DESC, y ASC indexing problem
Список pgsql-sql
Vincent,

> SELECT * FROM TABLE1 ORDER BY X DESC, Y ASC;
> 
> (X is a date and Y a varchar)
> 
> What would that index be?
> 
> Is there a function I can use, to invert x (the date), so that I can
> make a query / index set like :

PostgreSQL's sorting mechanism can use an index either ascending or
descending; it does not make a difference.

However, most of the time ORDER BY does not use an index at all because
a seq scan is faster.   Usually, ORDER BY  uses an index only when
combined with related criteria and/or the LIMIT clause.

-Josh Berkus


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

Предыдущее
От: Vincent-Olivier Arsenault
Дата:
Сообщение: order by x DESC, y ASC indexing problem
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: order by x DESC, y ASC indexing problem