When reading this and this , and then reading this (which refers to the other two, ironically), I wonder how big is the discussion on this topic? I'm a SQL Server guy, so I tend to use an identifier that is automatically generated in int form. However, when I know that I will need some form of replication between the server and the server or synchronization between the client and the server, I use the GUID as my key.
Question: Should I just use the GUID as the primary key in all tables at all times, just in case I need this possible scalability in the future? Does this make my scheme more flexible in that it can be transferred between platforms at all times? Does it help me maintain the flexibility of my ORM (regardless of taste) without embedding specific platform features?
Answers:
@David Archer: for your comment, I updated the post not to say "Natural Key". You are right that a natural key is defined as such . Thanks for the correction.
, , lo/hi, NHibernate ( ). GUID . , , .
, , , , , , . - " " NHibernate. UoW , , , .
GUID , GUID . " ", , DateInserted .
GUID , 4- , , .
- .:)
, GUID . . SQL Server , " ", . . - ...
(, " " ). 40% , , .
GUIDS , , (.. ..).
SQL Server , , .
, . 10 000 ( ), , , , 10 000 ( ), , ( ) Big Ints ( ) + (autonumber), .
- (, ).
, , GUID SQL Server - , , .
- - GUID , .
- , , - GUID . , , , (, , ) .
, , , GUID (16 ) INT (4 ) - .
/ GUID, , - , SQL Server, - !
: , , , , . GUID ( ). GUID, NEWSEQUENTIALGUID() SQL Server, , .
, " " , - . , GUID , , - .
, GUID . 4 36 .
GUID , . URL , 1156712. - SO (, SU), , URL-, , , google. , GUID, int bigint, .
- . , " " .
Source: https://habr.com/ru/post/1713112/More articles:Processing a multidimensional data structure in .Net 3.5 and later - arraysHow to overload the operator without changing the initial values? - c ++What is the best way to get the local computer name in Delphi - delphiHow to write an exception in section 7 of GPLv3? - gplEncapsulate a Windows message loop in a DLL - c ++Reset jQuery Accordion - jqueryCombining keys / values ββfrom C ++ STL associative containers - c ++C # with Selenium Ajax DropdownList release question - c #How to make PHP faster: is there a line creation? - optimizationHow to make an array loop faster in PHP - phpAll Articles