Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql unlimited primary keys auto increment

I have a question with im really unsure with. First feel free to downvote me if its a must but i would really like to hear a more experienced developers opinion.

I am building a site where i would like to build similar functionality like google circles.

My logic would be this. Every user will have circles attaced to them after signup.

example if the user will sign up

form filed and the following querys will be insierted to the database

**id   | circle_name       | user_id**
------------------------------------
1      | circle one        | 1
------------------------------
2      | circle two        | 1
------------------------------
3      | circle three      | 1

Every circle will have a primary key

But this is what im unsure with, so after a time im a bit scared that the table will break, what im mean is if it will reach a number of id's it will actually stop generating more.

When you specifiy an int in the database the default value is 11, yes i know i can incrase or set it to the value what i want, but still giveing higher values is a good idea?

or is there any possibility to make a primary key auto increment to be unlimited?

thank you for the opinions and help outs

like image 301
Side Avatar asked Dec 21 '12 09:12

Side


2 Answers

Just run some maths and you ll get the answer yourself. If a length can store billions of values and you don't expect to have 1 million new registrations every week then getting to a point where it breaks would be "practically" tough, even if "theoretically" possible

like image 162
Hanky Panky Avatar answered Oct 20 '22 07:10

Hanky Panky


or is there any possibility to make a primary key auto increment to be unlimited?

You can use a BIGINT.

Strictly speaking it's not unlimited, but the range is so incredibly huge that you wouldn't be able to use up all the values even if you tried really hard.

like image 44
Mark Byers Avatar answered Oct 20 '22 07:10

Mark Byers