From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Josh Berkus <josh(at)agliodbs(dot)com> |
Cc: | Vincent-Olivier Arsenault <vincent(at)up4c(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: order by x DESC, y ASC indexing problem |
Date: | 2002-10-04 03:12:11 |
Message-ID: | 20021004031211.GB3484@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, Oct 03, 2002 at 19:30:59 -0700,
Josh Berkus <josh(at)agliodbs(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-10-04 03:14:43 | Re: order by x DESC, y ASC indexing problem |
Previous Message | Bruno Wolff III | 2002-10-04 03:09:54 | Re: order by x DESC, y ASC indexing problem |