Auto Increment Question

Discussion in 'Databases' started by resting, Jun 28, 2009.

  1. #1
    If we use auto increment as our primary key, wouldn't the value just go out of range after say a few years?

    Is there some management in place to keep it in check while we delete records? Whats the general practice in the industry?
     
    resting, Jun 28, 2009 IP
  2. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #2
    The maximum unsigned value for INT type is 4294967295.

    The maximum unsigned value for BIGINT type is 18446744073709551615.

    Do you think you will exceed the above values in a few years? :D
     
    Social.Network, Jun 28, 2009 IP
  3. resting

    resting Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i'm not so sure cause i'm a newbie to databases and programming in the industry.

    so i guess we can safely disregard the concern of it going out of range rite?
    Thanks Social.Network :)
     
    resting, Jun 28, 2009 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes there should be no concern except in extreme circumstances, even if you think there might be a chance use BIGINT as the data type
     
    wd_2k6, Jun 28, 2009 IP
  5. resting

    resting Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ok got it. thanks guys :)
     
    resting, Jun 29, 2009 IP
  6. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #6
    u r rite :)
     
    shaibibutt, Jul 1, 2009 IP