I said: > Oh, wait, you're right --- I'm mis-visualizing the situation. > Hmm, it sure seems like there ought to be an easy way to do this...
The problem is that a multi-column index doesn't actually have the semantics you want. If you are willing to consider adding another index (or replacing the existing 3-column guy), how about create index ti on t((array[a,b,c])); select * from t where array[a,b,c] >= array[a1,b1,c1] order by array[a,b,c] limit 1 offset 1; This seems to do the right thing in 7.4 and later. It does require that all three columns have the same datatype though; you weren't specific about the data model ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend