order by x DESC, y ASC indexing problem

Поиск
Список
Период
Сортировка
От Vincent-Olivier Arsenault
Тема order by x DESC, y ASC indexing problem
Дата
Msg-id 3D9CF7EC.8080102@up4c.com
обсуждение исходный текст
Ответы Re: order by x DESC, y ASC indexing problem  ("Josh Berkus" <josh@agliodbs.com>)
Re: order by x DESC, y ASC indexing problem  (Bruno Wolff III <bruno@wolff.to>)
Re: order by x DESC, y ASC indexing problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Hello,

I saw a posting regarding this issue in august, with no solution...

How to have the planner use an index in the case of a query like :

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 :



CREATE INDEX INDEX1 ON TABLE 1 (INVERT(X), Y ASC);
SELECT * FROM TABLE1 ORDER BY INVERT(X) ASC, Y ASC;


Wouldn't it be great to have a mySQL, SAPDB-like syntax of the sort :

CREATE INDEX INDEX1 ON TABLE 1 (X DESC, Y ASC);


Thanks,


vincent



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: drop constraint primary key
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: order by x DESC, y ASC indexing problem