Super User is a question and answer site for computer enthusiasts and power users. 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 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

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .