Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Unanswered: automatically indexed

    Hello there,

    Easy question, couldn't find in our oracle-pdfs. When I make a primary key on a table. will ths primary key automatically be indexed?

    ALTER TABLE ISH.Employee ADD CONSTRAINT pk_Employee PRIMARY KEY( EmpId );

  2. #2
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Arrow Indexes are automatic

    Hi
    If you look through PDFs on otn.oracle.com, you would find enough documentation on indexes.

    By the way, indexes are controlled by the system when u have the primary key, and unique constraints.
    So whenever u have a column as the primary key, an index is created on that column.

    If that Index would be used in a query or not, would be controlled by Oracle execution path, what oracle decides.

    Do let me know if you need more specific information on indexes.
    Thanx and Regards
    Aruneesh

  3. #3
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    No, you need to add the using index clause.

    Alan

  4. #4
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    and dont forget to analyze the table if your not using the rule based optimizer.

    Alan

  5. #5
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    Take it back, it will create an index by default in the same tablespace as the table. You should still use the 'using index' clause though as then you can specify a different tablespace (i.e. disk/stripe) for the index to improve performance.

    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •