Re: Use index for order by ?

From: Reinhard Kuhn <kuhn_at_cas-ps.com>
Date: 1996/01/22
Message-ID: <4dvncq$iei_at_fred.cas-ps.com>#1/1


In article <4dkjpu$gt2_at_news.nyc.pipeline.com>, utrankar_at_nyc.pipeline.com says...
>
>Is there a way to make Oracle use index on a table for ordering rows ?

If you have an index on the 'ordering' columns and if at least one of these columns is declared 'not null' Oracle in most cases uses this index for 'order by' queries.

The 'not null' constraint is important, since Oracle doesn't store keys in an index, if the key consists of null values only. Hence a row with such a 'null key' cannot be retrieved through an index. Since the optimizer doesn't know the data, it relies on the existence of the constraint only.

Hope this helps

-- 
    _/_/_/   _/_/_/ _/    _/  // Reinhard Kuhn             /  It can be      
   _/    _/ _/     _/  _/    //         (kuhn_at_cas-ps.com) /  done quickly,   
  _/_/_/   _/_/_/ _/_/      // CAS GmbH                  /  cheaply or well  
 _/  _/   _/     _/  _/    // Lemberger Strasse 14      /   - pick any two!  
_/   _/  _/_/_/ _/    _/  // 66955 Pirmasens, Germany  /   
                                   
Received on Mon Jan 22 1996 - 00:00:00 CET

Original text of this message