I've being reading around reasons to use or not Guid
and int
.
int
is smaller, faster, easy to remember, keeps a chronological sequence. And as for Guid
, the only advantage I found is that it is unique. In which case a Guid
would be better than and int
and why?
From what I've seen, int
has no flaws except by the number limit, which in many cases are irrelevant.
Why exactly was Guid
created? I actually think it has a purpose other than serving as primary key of a simple table. (Any example of a real application using Guid
for something?)
( Guid = UniqueIdentifier ) type on SQL Server
int
has no flaws except by the number limit, which in many cases are irrelevant.": actually, within this context of INT vs GUID, the upper limit of a signed, 32-bitINT
is entirely irrelevant given that the upper limit of a signed, 64-bitBIGINT
is well beyond nearly all uses (even more so if you start numbering at the lower limit; and same goes forINT
) and it is still half the size of a GUID (8 bytes instead of 16) and sequential. – Solomon Rutzky Oct 7 '15 at 18:41