Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert primary key index to hash partitioned index

OraCAug 27 2020 — edited Sep 22 2020

I have a table:

create table MYRECORDS

(

   MYRECORD_ID NUMBER(20,0)         not null,

   MYRECORD_NAME             VARCHAR2(50),

   MYRECORD_DETAILS          VARCHAR2(500),

   constraint P_MYRECORDS primary key (MYRECORD_ID)

         using index

       initrans 20

       tablespace RECORDS

)

initrans 20

tablespace RECORDS;

Due to increased contention on the primary key index being reported I want to partition the primary key index as follows:

1) alter index P_MYRECORDS rename to P_MYRECORDS_2;

2) alter index P_MYRECORDS_2 invisible;

3) create unique index P_MYRECORDS on MYRECORDS (MYRECORD_ID) global partition by hash (MYRECORD_ID) partitions 10 initrans 20 tablespace RECORDS online;

4) alter table MYRECORDS modify constraint P_MYRECORDS using index P_MYRECORDS;

My questions are:

a) All the while through the process the P_MYRECORDS_2 index is still present. After step 4 it disappears. I would expect to explicitly have to drop it. Why is this the case?

b) Is there a better way to partition my primary key index?

Thanks!

Comments
Post Details
Added on Aug 27 2020
13 comments
1,875 views