Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kryptonit3's avatar

integer vs biginteger

Most examples (Laravel) across the internet use integer for auto-incrementing and unsigned (user_id etc) columns. While I know it will take quite some time to exhaust 4,294,967,295 (4.2 billion [unsigned]) records, is there that much of a hit future proofing my projects with bigIncrements and bigInteger for my schema design? biginteger being 18,446,744,073,709,551,615 (18.4 quintillion [unsigned])

Can a integer column be converted to biginteger? If so can an auto-incrementing integer column be converted the same?

I think I read somewhere that WordPress now by default uses biginteger.

Would love to see what you guys think.

0 likes
2 replies
mstnorris's avatar
  1. Yes it can be changed.
  2. It depends on what you are developing.
2 likes
charlescason's avatar

I think using an "integer" data type (typically a 32-bit signed integer) allows for a range of approximately -2.1 billion to +2.1 billion values. This range is generally sufficient for most applications, especially if you don't anticipate reaching the upper limit of 4.2 billion records any time soon.

However, if you foresee the possibility of exceeding the limits of the "integer" data type in the future, or if you require a larger range of values from the beginning, then using a "bigInteger" data type (typically a 64-bit signed integer) can be a good choice. A "bigInteger" can accommodate values ranging from approximately -9 quintillion to +9 quintillion, which provides a significantly larger range.

1 like

Please or to participate in this conversation.