简体   繁体   English

为什么数据库具有奇怪的字母数字键

[英]Why does a database have a weird alphanumeric key

I am trying to connect data in two databases, both created automatically by a different UI application. 我正在尝试连接两个数据库的数据,这两个数据库都是由不同的UI应用程序自动创建的。 In one, all the keys are in this format "D8FC23D7-97D6-42F5-A52F-1CE93087B3A4". 一种是,所有密钥的格式均为“ D8FC23D7-97D6-42F5-A52F-1CE93087B3A4”。

Is there any reason this would be done? 有什么理由要这样做吗? I also saw keys that look similar in a GIS database. 我还看到了在GIS数据库中看起来相似的键。 I can't tell if these are supposed to be some computed key, maybe to detect what I am trying to do, or just random with some other intent. 我无法确定这些键是否应该是某个计算键,也许无法检测到我要执行的操作,还是只是出于某种随机目的。

PS I am using SQL Server. PS我正在使用SQL Server。 From what I can gather, this is not something that would be auto generated by SQL Server. 据我所知,这不是SQL Server自动生成的。

This is a GUID, also called UUID, a universally unique identifier (confer, for example, wikipedia or rfc4122 ). 这是GUID,也称为UUID,是通用的唯一标识符(例如,授予Wikipediarfc4122 )。 The idea behind a guid is that applications can generate identifiers, that are globally unique, without the need of a central unit doing any choreography (see motivation from rfc4122 below). guid背后的想法是,应用程序可以生成全局唯一的标识符,而无需中央单元进行任何编排(请参见下面来自rfc4122的动机)。

Various systems, databases, and programming languages offer functionality for generating UUIDs (eg SELECT NEWID() in sql server); 各种系统,数据库和编程语言都提供了用于生成UUID的功能(例如sql server中的SELECT NEWID() )。 the benefit is that with UUID generators, application can generate globally identified units in autarkical manner. 好处是使用UUID生成器,应用程序可以以自给自足的方式生成全局标识的单元。

UUIDs can serve as database keys, though in most cases you will find much more lightweight and much more proper keys. UUID可以用作数据库密钥,尽管在大多数情况下,您会发现更加轻巧和更合适的密钥。

One of the main reasons for using UUIDs is that no centralized 使用UUID的主要原因之一是没有集中式
authority is required to administer them (although one format uses 需要对其进行管理(尽管使用一种格式
IEEE 802 node identifiers, others do not). IEEE 802节点标识符,其他则没有)。 As a result, generation 结果,一代
on demand can be completely automated, and used for a variety of 按需可以完全自动化,并用于各种
purposes. 目的。 The UUID generation algorithm described here supports very high allocation rates of up to 10 million per second per machine if 如果此处描述的UUID生成算法支持很高的分配速率,则每台机器每秒最多可达到1000万
necessary, so that they could even be used as transaction IDs. 是必要的,这样它们甚至可以用作交易ID。

UUIDs are of a fixed size (128 bits) which is reasonably small UUID具有固定大小(128位),相当小
compared to other alternatives. 与其他替代品相比。 This lends itself well to sorting, 这很适合进行排序,
ordering, and hashing of all sorts, storing in databases, simple 各种排序和散列,存储在数据库中,简单
allocation, and ease of programming in general. 分配,并且总体上易于编程。

Since UUIDs are unique and persistent, they make excellent Uniform Resource Names. 由于UUID是唯一且持久的,因此它们是出色的统一资源名称。 The unique ability to generate a new UUID without a 生成新UUID的独特能力
registration process allows for UUIDs to be one of the URNs with the 注册过程允许UUID成为具有以下特征的URN之一
lowest minting cost. 最低的造币成本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM