From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | 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 02:30:59 |
Message-ID: | web-1771021@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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.
However, most of the time ORDER BY does not use an index at all because
a seq scan is faster. Usually, ORDER BY uses an index only when
combined with related criteria and/or the LIMIT clause.
-Josh Berkus
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2002-10-04 03:09:54 | Re: order by x DESC, y ASC indexing problem |
Previous Message | Vincent-Olivier Arsenault | 2002-10-04 02:07:40 | order by x DESC, y ASC indexing problem |