On Fri, Apr 23, 2004 at 16:33:14 +0200,
  Antal Attila <[EMAIL PROTECTED]> wrote:
> 
> In our experience, postgres cannot use a multi-colum index on (col1,
> col2) in this situation, becouse there are different directions after
> ORDER BY. Is custom operator class the easiest solution, which can solve
> the reverse indexing on col2? Our problem with this solution, is that we
> have to replace "DESC" with "USING myoperator". Is it possible, that
> postgres can recognize "myoperator" without replacing "DESC"?  

Another option you might have is using functional indexes. If you are using
7.4.x or greater and one of the columns has a reasonable - operator
(pretty much this is the numeric types) then you can have an index on
(col1, (-col2)) and then order by col1, -col2.

The main advantage is that this is simpler than making a new opclass.
If you have already gone to that trouble it may be better to stick with it.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to