Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Speed of PrimaryKey vs Index

Re: Speed of PrimaryKey vs Index

From: Matthias Gresz <GreMa_at_t-online.de>
Date: Thu, 04 Mar 1999 09:57:15 +0100
Message-ID: <36DE4AEB.594CFEF9@t-online.de>

Stan schrieb:
>
> I am using Oracle with Delphi (using a TTable and TDBGrid - this is not
> necessary to know).
> I am using a grid component to display my data. When the data is sorted
> on the primary key, it navigates very quickly. However, if I switch the
> sort order to the Index key, it moves very slowly.
>
> I then dropped the indexes and primary key, and then defined the primary
> key as the column which was previously the index. It navigates fine.
> This makes me conclude that there is a difference in the speed between a
> primary key and a index key. Would anyone have any idea why the indexes
> are working so slowly?
>
> Stan.

Hi,

oracle automatically builds an index when a primary key constraint is declared, 'cause this is the only way that oracle can guarantee its uniqueness.
So, from this point of view there's no diference between an index and a primary key. The difference might be in your select statement, which may not allow oracle to use the index. Try using hints and check oracle's optimizer mode.

HTH
Matthias
--
grema_at_t-online.de

Protect privacy, boycott Intel: http://www.bigbrotherinside.org Received on Thu Mar 04 1999 - 02:57:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US