Reputation: 7789
I understand int stores about 4 bytes and bigint stores about 8 bytes in MySQL
Since one can specify the length of each field in MySQL, Will an int(20) takeup the same space as a bigint(20)?
Upvotes: 0
Views: 350
Reputation: 1269443
This is a bit long for a comment.
The number of bytes occupied by a value is determined by the type. You can see the list of numeric types and their sizes here.
In addition, MySQL supports "attributes" on numeric types. The (20)
is a display width on output. The attributes are explained here.
So, for your example, the storage occupied by the fields is different because the types being used are different.
Upvotes: 2