pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vincent-Olivier Arsenault <vincent@up4c.com>
To: pgsql-sql@postgresql.org
Subject: order by x DESC, y ASC indexing problem
Date: Thu, 03 Oct 2002 22:07:40 -0400
Message-ID: <3D9CF7EC.8080102@up4c.com> (raw)

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




view thread (5+ messages)  latest in thread

Message-ID: <3D9CF7EC.8080102@up4c.com>
Permalink:  ../3D9CF7EC.8080102@up4c.com/
Also on:    postgresql.org/message-id/3D9CF7EC.8080102@up4c.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vincent@up4c.com
  Subject: Re: order by x DESC, y ASC indexing problem
  In-Reply-To: <3D9CF7EC.8080102@up4c.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox