"David Witham" <[EMAIL PROTECTED]> writes: > So I see that there is the extra sort above the sub-query that > wouldn't be there using 7.4. Are you saying that the sort by survey > after the sort by survey,question would potentially reorder the > records initially sorted by survey,question?
Exactly. Most implementations of qsort() aren't "stable", which means they might reorder equal keys in some random way. So to preserve the sub-ordering on question, you need the upper sort to be skipped. The 7.4 planner is smart enough to notice it doesn't need the upper sort, prior releases were not. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]