Primary Key in another Index [message #605965] |
Thu, 16 January 2014 17:51 |
sujitm30
Messages: 10 Registered: September 2005
|
Junior Member |
|
|
I have a single column primary key in a table with about 10M records.
This column happens to be VARCHAR2(20). But has numeric values in it.
(Due to some historical reasons that it had characters at one point).
This table is quite wide with more than 100 columns. And there are
several indexes that I am trying to revisit and come up with a better
indexing plan.
My foremost question is:
IS THERE ANY GOOD REASON A PRIMARY KEY COLUMN BE PART OF ANOTHER INDEX?
EXAMPLE:
PK_RENTAL_KEY (RENTAL_KEY)
IDX_STORE_PICKUP (STORE_NO, PICKUP_DATE, RENTAL_KEY, STATUS)
I noticed there are several composite indexes which also have this
primary key column as part of the index. This is something I am
strongly against. I was of the opinion that if any SQL predicate
has the primary key column in it, then it will automatically go to
the PK index.
|
|
|
|
|
Re: Primary Key in another Index [message #605977 is a reply to message #605968] |
Fri, 17 January 2014 01:15 |
|
hi friend,
Yes,It can be good if you are using same composite index column list into your .sql query select/where clause.
But,always better to check explain plan for getting coorect idea.
Please use following sequence of steps :
Step 1: explain plan for
<sql query>
Step 2: select *
from table(dbms_xplan.display)
Normally more indexing helps where we have Denormalized tables e.g. OLAP/Data Warehousing
|
|
|