A
A
Andrey Tokmakov2014-03-07 10:29:20
Database design
Andrey Tokmakov, 2014-03-07 10:29:20

The maximum value of the Integer data type is 2 billion 147 million. How much is there, what if the record table has more than this number?

For example, we have a mysql database, it has a table with comments, in which there is a field
id INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, at one point the 2,147,483,647th comment is written there, what happens next when you try to write another comment? And most importantly, what to do with the base in this case? Let's omit the option with deleting old comments.
ps for those who do not understand the meaning - the integer type takes a value from -2,147,483,648 to +2,147,483,647
In principle, the theoretical answer is also interesting, but I would like to hear the answer of those who have already encountered this, so to speak, live, in practice.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xandox, 2014-03-07
@xandox

I'm not sure if mysql will live to this extent, but all normal people for id usually use unsigned values ​​or 32 or 64 bits as needed.

V
v_prom, 2014-03-07
@v_prom

If you need sky-high table sizes, then you can use a composite key.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question