Reputation: 3
I created a table with column id as int data type. However, I realized that int type may not be able to hold some of the values I might put in the table. I wish to find out, if I define the column as bigint, does it take up "space" or does it use space on the database EVEN before I put a value in the column? I am using sql server 2008 R2. Thank you.
Upvotes: 0
Views: 1270
Reputation: 1496
Every time you enter any number, even 1, it will use the full 8 bytes. So the extra storage overhead is 4bytes * number of rows. If you are worried that you numbers will grow higher than 2,147,483,647, then you should use bigint.
Upvotes: 1
Reputation: 28064
int always uses 4 bytes, bigint always uses 8 bytes. The actual value stored does not affect the size of the field.
Upvotes: 5