Recently one of my friend ask me when I should go for GUID and When I should go for Int as primary key in table. So decided to write a blog post for it. Here are advantages and disadvantage of the GUID and INT. INT Data Type:Advantages:
- Its required small space in terms of the storage it will only allocates 4 bytes to store data.
- Insert and update performance will be faster then the GUID. It will increase the performance of the application.
- Easy to index and Join will give best performance with the integer.
- Easy to understand and remember
- Support of function that will give last value generated like Scope_Indentity()
Disadvantages:
Read more: DotNetJaps
- If you are going to merge table frequently then there may be a chance to duplicated primary key.
- Limited range of uniqueness if you are going to store lots of data then it may be chance to run out of storage for INT data type.
- Hard to work with distributed tables.
- It is unique for the current domains. For primary key is uniquely identifies the table.
- Less chances of for duplication.
- Suitable for inserting and updating large amount of data.
- Easy for merging data across servers.
Read more: DotNetJaps
0 comments:
Post a Comment