Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
Take a look at this thread though it's difficult to tell if it relates because of the vagueness of your question –  Raystafarian Feb 15 '12 at 18:18
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.