pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: theo@flame.co.za
Cc: pgsql-performance@postgresql.org
Subject: Re: Multicolumn order by
Date: Tue, 18 Apr 2006 19:08:33 -0400
Message-ID: <19819.1145401713@sss.pgh.pa.us> (raw)
In-Reply-To: <1145398075.3048.18.camel@josh>
References: <1145398075.3048.18.camel@josh>

Theo Kramer <theo@flame.co.za> writes:
> select * from mytable where
>   (c1 = 'c1v' and c2 = 'c2v' and c3 >= 'c3v') or
>   (c1 = 'c1v' and c2 > 'c2v') or
>   (c1 > 'c1v')
>   order by c1, c2, c3;

Yeah ... what you really want is the SQL-spec row comparison operator

select ... where (c1,c2,c3) >= ('c1v','c2v','c3v') order by c1,c2,c3;

This does not work properly in any current PG release :-( but it does
work and is optimized well in CVS HEAD.  See eg this thread
http://archives.postgresql.org/pgsql-hackers/2006-02/msg00209.php

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <19819.1145401713@sss.pgh.pa.us>
Permalink:  ../19819.1145401713@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19819.1145401713@sss.pgh.pa.us

 · 

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-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, theo@flame.co.za
  Subject: Re: Multicolumn order by
  In-Reply-To: <19819.1145401713@sss.pgh.pa.us>

* 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