I suggest you never take into account the GUID, one of the reasons is that I am currently having problems with them, if you have millions of users, then you may need a large degree of concurrency, and the guides will ruin your life while inserting and delete, you will have a pointer to them, and by default it will be a Clustered index, which means that when you have a clustered index, each insertion and deletion will move the record physically, and, in addition, the Guides are not sequential, so the probability is h to insert each new top or bottom of the page. therefore, the general operation of inserting and deleting will become very expensive, and if you delete the index, your selections will become expensive.
Specifically, if you have several tables and there are relationships between them, do not consider Guides as the Primary Key.
The following two solutions I would recommend.
if you can create compound keys that would be ideally as if its banking software then could be branchId, transactionId will become the main key, where branchId is the identifier of the node, inserting the record, and transactionId is the auto num in the branch so you get uniqueness all the way.
If the above is not what you like, or you think, then you can use Guid as a unique file, but add an auto-increase number as the primary key, this will help you reduce the total cost, for example, when a client (node) sends data using (web services) RPC, then you need to insert the record into the server database, then the autonomer number will be created, and this autonomous number can be used for future selection, deletion or updating, but the client does not need to know about this autonomer
I understand that the second solution is a bit confusing and complicated, but it is still better than using Guids as PK. but if solution 1 is applicable, we pass to it.
When I say "Cost", this is not only processing time, but also blocking (waiting) time, which means that it is a complete waste of money, and your quad-core server can execute half of them, and more locks mean more chances to lock, so my friend never uses Guides.
Relations Mubashar
Mubashar ahmad
source share