Is there some issue in have bigint column as primary key on mysql?

I need to know if i can set a bigint column as primary key?

1

1 Answer

You can use BIGINT as a primary key but with some penalties.

BIGINT takes up more space on disk storage than INT and using BIGINT as a primary key (or any index) will add size to the index, perhaps as much as doubling it.

This can have a performance impact on searching the index and make it slower to run queries.

I would suggest that unless you have plans to insert more than 2.1 Billion rows into one table you should just use INT. Otherwise you will loose perfomance.

If you plan to do more that 2.1 billion inserts into one table you will have to do a fair bit more research than asking on SuperUser.com.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like