Is it a bad idea to use GUIDs as primary keys in MS SQL?

前端 未结 7 1351
时光说笑
时光说笑 2020-12-23 08:10

We have a system that uses UniqueIdentifier as the primary key of each of the tables. It has been brought to our attention that this is a bad idea. I have seen similar post

相关标签:
7条回答
  • 2020-12-23 08:50

    It is a "bad" idea. It can be slow. You it isn't really good for fast searching with indexes either. The only real time that we use GUID or UniqueIDs is when we have to keep data items connected across databases, typically when we have a server database and a local database for an application (for disconnected systems). You really have no other way to keep things together other than guids. For indexes and primary keys, you want to use an integer value and try to link things with association tables rather than using guids all over the place.

    0 讨论(0)
提交回复
热议问题