If it is a number, store it as a number.
Integers are stored using 4 bytes, giving them the range:
-2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
So, suitable for your needs.
char[8]
will be stored as 8 bytes, so double the storage, and of course suffers from the need to expand in the future (converting almost 10M records from 8 to 9 chars will take time and will probably require taking the database offline for the duration).
So, from storage, speed, memory and disk usage (all related to the number of bytes used for the datatype), readability, semantics and future proofing, int
wins hands down on all.
Update
Now that you have clarified that you are not storing numbers, I would say that you will have to use char
in order to preserve the leading zeroes.
As for the issue with future expansion - since char
is a fixed length field, changing from char[8]
to char[9]
would not lose information. However, I am not sure if the additional character will be added on the right or left (though this is possibly undetermined). You will have to test and once the field has been expanded you will need to ensure that the original data has been preserved.
A better way may be to create a new char[9]
field, migrate all the char[8]
data to it (to keep things reliable and consistent), then remove the char[8]
field and rename the new field to the original name. Of course this would ruin all statistics on the table (but so would expanding the field directly).