Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why use GUID primary keys?

GUID keys primary
0
Posted

Why use GUID primary keys?

0

To fulfill Ubik’s goal of predictability, it is necessary that newly-created objects are indistinguishable from those stored in the database. If a piece of client code uses an object/its identity to form a query, then that identity needs to be distinct from that of all other newly-created objects. The fact that an object does not change its identity during its lifetime (as it would if its identity were generated upon database insertion) also helps to keep behaviour consistent. Another worthwhile benefit of using GUIDs is that they make it possible that transparent online/offline smart client support could be added to Ubik without a great deal of additional complexity. Space/performance considerations need to be made on a project-by-project basis, however they don’t usually preclude using GUIDs – consider that 1,000,000 GUIDs take approximately 16 MB of storage, compared to 4 MB for integers. These are both small numbers when considering filesystem storage on a modern server.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123