Re: Multicolumn indexes and ORDER BY

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Multicolumn indexes and ORDER BY
Дата
Msg-id 20040616061213.GA3567@svana.org
обсуждение исходный текст
Ответ на Multicolumn indexes and ORDER BY  (Jernej Kos <kostko@jweb-network.net>)
Ответы Re: Multicolumn indexes and ORDER BY
Список pgsql-general
On Wed, Jun 16, 2004 at 07:12:26AM +0200, Jernej Kos wrote:
> I have a multicolumn index on two columns. If i use the columns in ORDER BY
> like this:
>   ORDER BY col1, col2;
>
> The index is used. But, if one column is sorted DESC it is not used:
>   ORDER BY col1 DESC, col2;
>
> How can i make this work ?

Try:

ORDER BY col1 DESC, col2 desc;

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Jernej Kos
Дата:
Сообщение: Multicolumn indexes and ORDER BY
Следующее
От: "zuhans@iname.com"
Дата:
Сообщение: why no answer? [Fwd: backup and restore just with use of jdbc?]