What is the MAX number if I store int(255) in MySQL?

前端 未结 5 1242
无人及你
无人及你 2020-12-02 23:06

I use int(255) in mysql as my id. Is this long enough? If I got about 1,000,000 records....Thank you.

5条回答
  •  情话喂你
    2020-12-02 23:51

    Something is probably just converting that to int(11) for you. Since you can't have 255 visible digits in an int, the maximum value will be 2147483647.

    If you need more than that you can set it to be unsigned, since I'm assuming you have no negative ids and then you can have up to 4294967295.

    If you are ever going to have more than 4 billion records (very unlikely if you're at 1 million right now), then you could use a bigint instead, which allows you to store numbers up to 18446744073709551615 at a cost of more storage space of course.

提交回复
热议问题