On Tue, Oct 03, 2006 at 03:44:38PM -0400, Tom Lane wrote: > select count(*) from > (select random()::text from generate_series(1,1000000) order by 1) ss; > ... > postgres=# select count(*) from (select random() from > generate_series(1,1000000) order by 1) ss;
I'm wondering whether 'order by 1' is representative of a real sort, from the perspective of benchmarks. I wonder why 'order by CONSTANT' might not be safe to optimize away as no sort at all? For sort functions that incrementally improve the sort order, I would expect 'order by 1' to be a worst case scenario. Is that the intention? Or is qsort unaffected by this use? Cheers, mark -- [EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED] __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/ ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match