• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Does Oracle automatically create a unique index for PK ?

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using oracle 10g XE. When I use the GUI to create a table and specify a PK. It shows that the script automatically creates a constraint for this PK. This makes sense. Then I found that when I pick "index" button, I saw this index whose name is identical to the PK name. So does Oracle 10g automatically creates such a unique index using this PK for me ?
 
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,
Yes, Oracle creates an index automatically on the primary key column(s).
 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Since I didn't know Oracle automatically creates index for its PK. I manually created "another" index on the PK using a different index name

create unque index "MY_TABLE_INDEX" on "MY_TABLE"(ID);

Does this duplication cause any problem ?
 
Jeanne Boyarsky
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,
No problem. It does use some extra disk space, but won't interfere with the running of queries.
reply
    Bookmark Topic Watch Topic
  • New Topic