Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to store a lot of large numbers that truncate when stored as INT values. Unfortunately they are too large for this type.

I'm thinking about using Base36 encoding to accomplish this. Are there any other ways to go about fixing this problem?

share|improve this question
How big are the numbers? Bigger than BIGINT can store? – ypercubeᵀᴹ Aug 27 '12 at 14:48
oh wow :p didn't know there was such a thing as BIGINT... I'm a C programmer at heart still – Glenna Mccraw Aug 27 '12 at 14:53
up vote 13 down vote accepted

More often than not, Base36 encoding will lead to a loss of precision as the base conversion process requires floating point number operations. Not only will this corrupt your data when converting to and from Base36, you will also be consuming more space (INT takes up 4 bytes, many Base36-encoded integers near the 32-bit unsigned integral limit will take up more than this).

See PHP's documentation for a thorough explanation on the loss of precision.

Answer: You should be using BIGINT for your operations.

share|improve this answer

You can use either,

the bigger than INT, integer BIGINT datatype:

BIGINT UNSIGNED: values from 0 up to 2^64-1 (about 18 * 10^18)

BIGINT SIGNED: values from -2^63 up to 2^63-1 (about -9 * 10^18 to 9 * 10^18)

or fixed-point NUMERIC (also named DECIMAL) datatype:

DECIMAL(M, 0): values from -(10^M-1) up to 10^M+1

The M can be up to 65, so you can store integers with up to 65 decimal digits.

share|improve this answer
thanks for your help :) – Glenna Mccraw Aug 27 '12 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.