Re: internal order of oracle tables

From: Robert J. McCallister <rjmac_at_crl.com>
Date: 9 Jul 1994 07:00:55 -0700
Message-ID: <2vmain$spd_at_crl.crl.com>


Sure there is a way to have all the records in a table sorted by the primary key, it is not very easy but try this:

Print out all your records, get a bunch of file folders, label each folder with the primary key, place the record in each folder, place the folders in the file cabinet in order by the primary key. That is pretty simple right? Does what you want right? Takes to much time right?

Alternative:

Let Oracle do the work for you, what difference does it make what order the records are in the table, to get them out in the proper order all you have to use is an order by clause in the select statement, if you want Oracle to process the select statement quickly then build a index on the primary key. Just remember that if in your order by clause you put in fields that are not in the index Oracle will not use the index.

One way to guarantee that the records will be inserted in proper order is to create sequence on the primary key and every time a new record is created the primary key will be created in sequential order, if you have more tan one filed as the primary key then concatenate the sequence.

Martin Dreis (mdreis_at_world.nad.northrop.com) wrote:
:*is there anyway to have oracle keep a table in order by
:*primary keys? just wondering if we can get away from having
:*to use order by on some of our selects.
 

:*please feel free to post or respond to me directly.
 

:*thanks.
Received on Sat Jul 09 1994 - 16:00:55 CEST

Original text of this message