Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Does selecting a primary key column in select , from a table do an automatic order by
Ravi, I have two points: First, Jim is right. Normal tables are heap
tables and heaps are unordered collections of rows. If you need the
result set ordered then specify an "order by" clause. Different plans
can result in differently ordered result sets for the same query. With
a cost based optimizer the plan can change as the data changes.
Second, where are you doing the summations? Obviously, you are performing them outside the SQL on the result set. Why are you not performing the summations in the query? It would likely be more efficient. From reading your post it seems that you should be using a group by operation.
HTH -- Mark D Powell -- Received on Fri Feb 03 2006 - 08:11:38 CST