Re: order by x DESC, y ASC indexing problem
| От | Bruno Wolff III |
|---|---|
| Тема | Re: order by x DESC, y ASC indexing problem |
| Дата | |
| Msg-id | 20021004031211.GB3484@wolff.to обсуждение исходный текст |
| Ответ на | Re: order by x DESC, y ASC indexing problem ("Josh Berkus" <josh@agliodbs.com>) |
| Список | pgsql-sql |
On Thu, Oct 03, 2002 at 19:30:59 -0700, Josh Berkus <josh@agliodbs.com> wrote: > 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. Note this is referring to a multicolumn index. To use all columns of a multicolumn index the sort directions all need to be the same. However you are right to point out that this may not be a big deal for many applications where using the index on the first column gets the majority of the speed up.
В списке pgsql-sql по дате отправления: