sql - What are the reasons *not* to use a GUID for a primary key? -


Whenever I design a database, with the GUID primary key for auto-generated for each of my tables Automatically starts (tables except exceptions)

I know that I will never sleep on duplicate keys, merging tables, etc. For me, it is only philosophically understood that any record should be unique to all domains, and that it should be specific that the table is represented in a consistent manner in the table.

I think that this will never be the highest performing option, but to perform on one side, I want to know that there are philosophical arguments against this practice?

I am continuously talking about using a GUID rental key as a primary key - no matter how natural And whether or sequential keys are prepared on a table. These are my beliefs:

  1. Data based on natural keys can be designed for integrity, but not assumed.
  2. The function of the primary key is fair integrity, despite the execution, indexing, or data.

Jeff Atwood talks about this in great detail:

Guid professionals:
Unique in every table, every database, every server
allows easy archiving of records from different databases
Easy to databases in multiple servers Distribution allows
You can generate ID anywhere, instead of having a roundtrip for the database
For most replication scenarios, GU ID column needs any kind

Guid Cons:
This traditional 4-byte index is 4 times bigger than the price; If you are not careful, then there may be serious performance and storage effects
Cumbersome to debug (where user ID = '{BAE7DF4-DDF-3RG-5TY3E3RF456AS10}')
Generate GUIDs partially To enable the best performance from (such as on SQL 2005), and the use of Clustered Indexes


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -