更新时间:2023-02-07 13:36:44
是的,机器之间不可能有重复.
Yes, there is no chance of a duplicate between machines.
NEWID()
基于伪随机数(来自时钟)和主 NIC 的 MAC 地址的组合.
NEWID()
is based on a combination of a pseudo random number (from the clock) and the MAC address of the primary NIC.
然而,像这样插入随机数作为表上的聚集键对性能来说是很糟糕的.您应该考虑使用 NEWSEQUENTIALID()
或 COMB 类型的函数来生成 GUID,这些函数仍提供 NEWID()
的冲突避免优势,同时仍保持可接受的 INSERT
性能.
However, inserting random numbers like this as the clustered key on a table is terrible for performance. You should consider either NEWSEQUENTIALID()
or a COMB-type function for generating GUIDs that still offer the collision-avoidance benefits of NEWID()
while still maintaining acceptable INSERT
performance.