Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: Length of a Primary Key


    I have a question regarding the length of a primary key.
    I have to create a table with one VARCHAR2 primary key field.
    At the beginning the table has about 14 million datasets and every day about 200.000 datasets will be inserted.

    I have the choice to choose a primary key field with a length of 42 characters (hex-coded values) or 65 characters.

    My question is:
    What are the performance disadvantages when I choose VARCHAR2(65) instead of VARCHAR2(42)?

    Sure, I need more Disk Space. But what is with queries or insert operations?

    Thanks in advance!!

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    Re: Length of a Primary Key

    Well, a longer key means less entries per block in the indexes, which means perhaps deeper indexes (more levels). The performance difference is probably small, but clearly the shorter key will as fast or faster than the longer one.

    If you have a clear choice, go with the shorter one. But if the longer one is preferable for other reasons, maybe stick with it (but perform some tests to see difference in performance).

Posting Permissions

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