I have a table with one million rows, there are no indexes on the table. The table has a column called sortcode which has no nulls, and has been generated in a highly random way so that no value appears more than four times. Consider the following queries:
select sortcode from t1 order by sortcode ; select sortcode from ( select sortcode from t1 order by sortcode ) where rownum <= 10 ;
How many rows are sorted in each of these two queries – and roughly how much memory would you expect Oracle to use ?
Addendum: in the light of comment #2, assume sortcode is char(6).