ORDER BY [PRIMARY_KEY] has to apply sort-order when it should simply use the index?
<p>according to my Research, ordering by the Primary key (or on any other column with an index) - the query should run without an explicit sort.</p>

<p>I also found a blog where this behavior was shown on different databases, one of them being Oracle.</p>

<p>However - in my Tests it this was not true - what could be the reason? Bad install-options? Broken Index? (although I ruled that out by creating a completely new table)</p>

<p>the query:</p>

<pre><code>select * from auftrag_test order by auftragkey
</code></pre>

<p>the execution plan:</p>

<pre><code> Plan Hash Value  : 505195503 

-----------------------------------------------------------------------------------
| Id | Operation            | Name         | Rows   | Bytes    | Cost  | Time     |
-----------------------------------------------------------------------------------
|  0 | SELECT STATEMENT     |              | 167910 | 44496150 | 11494 | 00:00:01 |
|  1 |   SORT ORDER BY      |              | 167910 | 44496150 | 11494 | 00:00:01 |
|  2 |    TABLE ACCESS FULL | AUFTRAG_TEST | 167910 | 44496150 |  1908 | 00:00:01 |
-----------------------------------------------------------------------------------
</code></pre>



<pre><code>create table AUFTRAG_TEST
(
   auftragkey           VARCHAR2(40) not null,
  ...
);
alter table AUFTRAG_TEST
  add constraint PK_AUFTRAG_TEST primary key (AUFTRAGKEY);
</code></pre>

<p>you might ask yourself why the Primary key would be a varchar field. Well,  this is something our bosses have decided. (Actually we put in stringified guids)</p>

<p>The blog I found:</p>

<p><a href="http://use-the-index-luke.com/sql/sorting-grouping/indexed-order-by" rel="nofollow noreferrer">http://use-the-index-luke.com/sql/sorting-grouping/indexed-order-by</a></p>

<p>P.S.: I think that I found out the Problem. This select does NOT "order by":</p>

<pre><code>select * 
from auftrag_test 
where auftragkey = 'aabbccddeeffaabbccddeeffaabbccdd' 
order by auftragkey
</code></pre>

<p>So - apparently - it does ONLY work, if you filter against an index, with "equality" which wouldn't be very helpful at all.</p>

<p>P.P.S: MS-SQL seems to do just what I expected. If I order by the Primary key (with a non clustered unique index) - the sort is "free". In execution plan, and also query time wise.</p>