Use the tips when you need to consider import / export to multiple databases. Guides are often easier to use than columns with an IDENTITY attribute when working with a dataset from multiple child relationships. this is due to the fact that you randomly generate commands in the code in the disconnected state from the database, and then send all the changes immediately. When prompts are generated properly, they are difficult to duplicate by accident. With identifier columns, you often have to enter the inner insertion of the parent row and request a new identity before adding child data. Then you need to update all child records with the new parent ID before passing them to the database. The same goes for grandchildren, etc. Down the hierarchy. He creates a lot of work that seems unnecessary and worldly. You can do something similar to Guides by combining with random integers without the IDENTITY specification, but the chance of a collision increases dramatically as you insert more records over time. (Guid.NewGuid () is like random Int128 - which does not exist yet).
I use bytes (TinyInt), Int16 (SmallInt), Int32 / UInt16 (Int), Int64 / UInt32 (BigInt) for small search lists that don't change, or data that doesn't replicate between multiple databases. (Permissions, Application Configuration, Color Names, etc.)
I believe that indexing takes as much time as queries, regardless of whether you use guid or long. Typically, tables typically index fields that are larger than 128 bits (usernames in the user table, for example). The difference between guides and integers is the size of the index in memory, as well as the time it takes to fill out and rebuild the indexes. Most database transactions are often read. The record is minimal. First, focus on optimizing reads from the database, as they usually consist of joined tables that were not optimized properly, improper swapping, or missing indexes.
As in any case, it is best to prove your point. create a test database with two tables. One with integer / long primary key and the other with a guide. Fill each one with N millionth rows. Monitoring the performance of each during CRUD operations (create, read, update, delete). You can find out that he has a performance hit, but a minor one.
Servers often run on mailboxes without debugging environments and other applications that take up the processor, memory, and hard disk I / O (especially with RAID). The development environment gives you an idea of โโperformance.
Lewie
source share