SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Primary/Foregin Key Question

    Currently I'm using A Natural Primary key for a table. It's a trip code that is 10characters (alphanumeric) long. Now, I need to relate this key to another table, often times with several items being related in a one-to-many fashion. (I.e. 15 trip highlights associated to one trip code).

    Would it be best just to use a simple surrogate key; i.e. a numeric ID? Once all trips are entered, the largest interger would only be four digits.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,016
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by NathanielB View Post
    Would it be best just to use a simple surrogate key; i.e. a numeric ID?
    no, i don't think so

    i doubt very much that the difference in processing speed between a 4-byte integer surrogate and a 10-char natural key is measurable unless you have a database the size of amazon's or ebay's
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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