GUID 冲突是否可能?

2023-07-17数据库问题
11

本文介绍了GUID 冲突是否可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在 SQL Server 2000 中开发一个数据库,该数据库为每个使用它所关联的应用程序的用户使用一个 GUID.不知何故,两个用户最终获得了相同的 GUID.我知道微软使用一种算法来生成一个随机 GUID,它导致碰撞的可能性极低,但碰撞仍然可能发生吗?

I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a collision still possible?

推荐答案

基本上没有.我认为有人搞砸了你的数据库.根据您使用的版本 GUID,该值要么是唯一的(对于版本 1 GUID 之类的东西),要么是唯一且不可预测的(对于版本 4 GUID 之类的东西).SQL Server 对其 NEWID() 函数的实现似乎使用 128 位随机数,因此您不会发生冲突.

Basically, no. I think someone went mucking with your database. Depending on the version GUID you're using the value is either unique (for things like version 1 GUIDs), or both unique and unpredictable (for things like version 4 GUIDs). SQL Server's implementation for their NEWID() function appears to use a 128-bit random number, so you're not going to get a collision.

对于 1% 的碰撞几率,您需要生成大约 2,600,000,000,000,000,000 个 GUID.

For a 1% chance of collision, you'd need to generate about 2,600,000,000,000,000,000 GUIDs.

这篇关于GUID 冲突是否可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

按天分组的 SQL 查询
SQL query to group by day(按天分组的 SQL 查询)...
2024-04-16 数据库问题
77

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

在 Group By 查询中包含缺失的月份
Include missing months in Group By query(在 Group By 查询中包含缺失的月份)...
2024-04-16 数据库问题
12

sql group by 与不同
sql group by versus distinct(sql group by 与不同)...
2024-04-16 数据库问题
37

如何在SQL中返回每个组的增量组号
How to return a incremental group number per group in SQL(如何在SQL中返回每个组的增量组号)...
2024-04-16 数据库问题
8

统计分组返回的记录数
Count number of records returned by group by(统计分组返回的记录数)...
2024-04-16 数据库问题
10