Re: CREATE INDEX .. ON table1 (field1 asc, field2 desc)

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: CREATE INDEX .. ON table1 (field1 asc, field2 desc)
Дата
Msg-id 20020825100056.C15448@svana.org
обсуждение исходный текст
Ответ на CREATE INDEX .. ON table1 (field1 asc, field2 desc)  (Timur <itvthor@sdf.lonestar.org>)
Ответы Re: CREATE INDEX .. ON table1 (field1 asc, field2 desc)  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
On Sat, Aug 24, 2002 at 08:18:25PM +0500, Timur wrote:
> Hello!
>
> I am new to PostgreSQL and databases in general, and I have this
> question: why it is not possible to specify ordering when creating an
> index?
>
> Let's say I have a query which looks like this:
> SELECT * FROM table1
> ORDER BY field1, field2 DESC
> LIMIT 100;
>
> Apparently, system won't use index ON (field1, field2) ..

It will if you do:
SELECT * FROM table1
ORDER BY field1 DESC, field2 DESC
LIMIT 100;

Time to go read that SQL book again?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Why is pgbench suddenly slow?
Следующее
От: Mark Stosberg
Дата:
Сообщение: Re: audit trail