Re: [PERFORM] Multicolumn order by

2006-04-19 Thread Theo Kramer
On Wed, 2006-04-19 at 08:00, Theo Kramer wrote: > I tried this on my test system running 8.1.3 and appears to work fine. > Appreciate it if you could let me know in what cases it does not work > properly. Please ignore - 'Explain is your friend' - got to look at the tips :) -- Regards Theo ---

Re: [PERFORM] Multicolumn order by

2006-04-18 Thread Theo Kramer
On Wed, 2006-04-19 at 01:08, Tom Lane wrote: > Theo Kramer <[EMAIL PROTECTED]> 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 SQ

Re: [PERFORM] Multicolumn order by

2006-04-18 Thread Jim C. Nasby
Assuming stats are accurate, you're reading through 5.5M index rows in order to run that limit query. You didn't say what the index was actually on, but you might want to try giving each column it's own index. That might make a bitmap scan feasable. I know this doesn't help right now, but 8.2 will

Re: [PERFORM] Multicolumn order by

2006-04-18 Thread Tom Lane
Theo Kramer <[EMAIL PROTECTED]> 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) >

[PERFORM] Multicolumn order by

2006-04-18 Thread Theo Kramer
Hi Apologies if this has already been raised... PostgreSQL 8.1.3 and prior versions. Vacuum done. Assuming a single table with columns named c1 to cn and a requirement to select from a particular position in multiple column order. The column values in my simple example below denoted by 'cnv' a