Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are GUIDs the ultimate ID?

Tags:

guid

I noticed some people don't bother having the usual incremented number as ID but instead simply generate a GUID. The advantages include:

  • Quick and easy
  • No need to keep track of previous IDs
  • Guaranteed to be unique even across machines without knowledge of each other

Some disadvantages are:

  • Possibly performance bottleneck
  • Uses a large number of bytes

My understanding is that using a GUID is beneficial in most cases, except if optimization for time or space is an issue. Did I miss something? Or do you agree with this idea?

like image 922
mafu Avatar asked May 03 '10 11:05

mafu


People also ask

Are GUIDs really unique?

A GUID is a unique number that can be used as an identifier for anything in the universe, but unlike ISBN there is no central authority - the uniqueness of a GUID relies on the algorthm that was used to generate it.

What is a GUID vs ID?

The guid can be used as needed to globally uniquely identify the row and id can be used for queries, sorting and human identification of the row. The id identifies the row in this table. The GUID (at least in theory) identifies this row anywhere in the known universe.

What is a GUID used for?

A GUID (globally unique identifier) is a 128-bit text string that represents an identification (ID). Organizations generate GUIDs when a unique reference number is needed to identify information on a computer or network. A GUID can be used to ID hardware, software, accounts, documents and other items.

How many unique GUIDs are there?

However, you can try to calculate the chance of creating two GUIDs that are identical and you get the idea: a GUID has 128 bits, hence, there are 2128 distinct GUIDs – much more than there are stars in the known universe.


1 Answers

A couple of cons:

  • Pain in the neck if you have to delve into anything manually (debuggin etc). They are completely unreadable.
  • Horrible if you ever need to pass them in a URL
like image 58
UpTheCreek Avatar answered Sep 18 '22 15:09

UpTheCreek