Eko Budiharto <[EMAIL PROTECTED]> wrote on 06/26/2005 11:02:30 AM:

> Hi,
> is there anyway that I can have more than 20 digits for integer 
> (bigInt)? If not, what I can use for database index?

BIGINT UNSIGNED can range from 0 to 18446744073709551615
(http://dev.mysql.com/doc/mysql/en/numeric-types.html)

Are you actually saying that you have a database with more than 1.8e+19 
records in it? I don't think you do. I think you are combining several 
pieces of information into something that looks like a number and it's 
exceeding the storage limits of even BIGINT.

What you have is actually a "good idea" but you are physically limited by 
the capacity of the column types available. In this case if you cannot 
create all of your key values so that they look like numbers smaller than 
18446744073709551615, it can't fit into a BIGINT UNSIGNED column.

You do have some options:
a) change the way you create your server keys so that they fit in the 
value allowed
b) use a character-based column to store your server key values
c) use some other value to identify your servers (IP address, for example)
d) create a table of server keys:

CREATE TABLE server (
        ID int auto_increment
        , name varchar(25) not null
        , ip int unsigned
        , ... (any other fields you could define to describe this server)
        , PRIMARY KEY (ID)
        , UNIQUE(name)
)

Then, refer to your servers using server.id instead of your composited 
key.

e) ...? (I am sure there are more ideas from others on the list)

To answer your literal question: No, MySQL cannot store integer values 
that contain more than 20 digits. Sorry!

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to