What exactly is GUID? Why and where I should use it?

GUID technically stands for globally unique identifier. What it is, actually, is a 128 bit structure that is unlikely to ever repeat or create a collision. If you do the maths, the domain of values is in the undecillions.

Use guids when you have multiple independent systems or clients generating ID’s that need to be unique.

For example, if I have 5 client apps creating and inserting transactional data into a table that has a unique constraint on the ID, then use guids. This prevents having to force a client to request an issued ID from the server first.

This is also great for object factories and systems that have numerous object types stored in different tables where you don’t want any 2 objects to have the same ID. This makes caching and scavenging schemas much easier to implement.

Leave a Comment