Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 To: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 Tags
Subject: RE: Primary Key
Thread ID: 143107 Message ID: 143321 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, August 27, 2007 8:31:58 PM         
   


> >
> > Not sure what you mean by that. The definition of a primary key - whether surrogate or intelligent, single column or compound, is simply that it is unique within the table to which it applies. So the only rule is that is must be unique within the table. However, when generating a GUID the rule is that it is unique within a two-billion year timeframe (or thereabouts) and has absolutely nothing whatever to do with tables.
>
> A PK must uniquely identify the row. Nowhere is it written what the nature of the PK must be.

I absolutely agree!- the only 'rule' is that is unique within the table - and while I would normally use a surrogate integer as a primary key that is by no means a requirement and is, again, just my preference based on 20+ years database experience including virtually all mainframe, mid-range and PC databases.

> Those that wrote the docs seem to feel it's a true GUID.

Yeah I am sure they do. Microsoft is notorious for re-defining accepted terms to mean whatever they want it to be - shades of Humpty-Dumpty in "Alice in Wonderland" who says "A word means just what I choose it to mean, neither more nor less"

Index-sequentiality is not any part of the definition of a GUID by any accepted term - in fact the essence of a GUID is its randomness - which simply cannot be true if they are sequential! Here are a few example definitions:

A Globally Unique Identifier or GUID is a pseudo-random number used in software applications. Each generated GUID is "statistically guaranteed" to be unique. This is based on the simple principle that the total number of unique keys ( or ) is so large that the possibility of the same number being generated twice is virtually zero.
en.wikipedia.org/wiki/GUID

The GUID is a randomised string that prevents duplicate messages from being sent by uniquely identifying a particular message or node on a P2P network.
www.peer-to-peer.arollo.com/glossary.html

A globally unique identifier (GUID) is used for unique IDs. No two GUIDs are the same no matter what computer they were generated on. The attribute clsid defines the GUID of the associated ActiveX control to use.
usa.autodesk.com/adsk/servlet/item

An identifier of an entity, such as persistent document, that has been generated by an algorithm guaranteeing its global uniqueness.
ihe.univ-rennes1.fr/TF/glossary.php

More extensive definitions can be found at:

GUID ( http://www.webopedia.com/TERM/G/GUID.html )Short for Globally Unique Identifier, a unique 128-bit number that is produced by the Windows OS or by some Windows applications to identify a particular component, application, file, database entry, and/or user. For instance, a Web site may generate a GUID and assign it to a user's browser to record and track the session. A GUID is also used in a Windows registry to identify COM DLLs. Knowing where to look in the registry and having the correct GUID yields a lot information about a COM object (i.e., information in the type library, its physical location, etc.). Windows also identifies user accounts by a username (computer/domain and username) and assigns it a GUID. Some database administrators even will use GUIDs as primary key values in databases.
GUIDs can be created in a number of ways, but usually they are a combination of a few unique settings based on specific point in time (e.g., an IP address, network MAC address, clock date/time, etc.).


and here

Globally Unique Identifier ( http://en.wikipedia.org/wiki/Globally_Unique_Identifier )
A Globally Unique Identifier or GUID (IPA pronunciation: ['gu.?d] or [gw?d]) is a special type of identifier used in software applications in order to provide a reference number which is unique in the context for which it is used, for example, in defining the internal reference for a type of access point in a software application, or for creating unique keys in a database. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2122 or 5.3×1036)[1] is so large that the probability of the same number being generated twice is very small.
The term GUID usually refers to Microsoft's implementation of the Universally Unique Identifier (UUID) standard; however, many other pieces of software use the term GUID including Oracle Database, dBase and Novell eDirectory. The GUID is also the basis of the GUID Partition Table, Intel's replacement for Master Boot Records under EFI


However, as noted in the Wikipedia definiton, a GUID is merely one implementation of the UUID standard which is described (http://en.wikipedia.org/wiki/UUID) as:
A Universally Unique Identifier is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE). The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. Thus, anyone can create a UUID and use it to identify something with reasonable confidence that the identifier will never be unintentionally used by anyone for anything else. Information labelled with UUIDs can therefore be later combined into a single database without needing to resolve name conflicts. The most widespread use of this standard is in Microsoft's Globally Unique Identifiers (GUIDs) which implement this standard. Other significant users include Linux's ext2/ext3 filesystem, LUKS encrypted partitions, GNOME, KDE, and Mac OS X, all of which use implementations derived from the uuid library found in the e2fsprogs package.

A UUID is essentially a 16-byte (128-bit) number. The number of theoretically possible UUIDs is therefore 216*8 = 2128 = 25616 or about 3.4 × 1038. This means that 1 trillion UUIDs would have to be created every nanosecond for 10 billion years to exhaust the number of UUIDs.

In its canonical form, a UUID consists of 32 hexadecimal digits, displayed in 5 groups separated by hyphens, for a total of 36 characters. For example:

550e8400-e29b-41d4-a716-446655440000
UUIDs are documented as part of ISO/IEC 11578:1996 "Information technology -- Open Systems Interconnection -- Remote Procedure Call (RPC)" and more recently in ITU-T Rec. X.667 | ISO/IEC 9834-8:2005 (freely available). The IETF has published Proposed Standard RFC 4122 that is technically equivalent with ITU-T Rec. X.667 | ISO/IEC 9834-8.

A UUID may also be used with a specific identifier intentionally used repeatedly to identify the same thing in different contexts. For example, in Microsoft's Component Object Model, every component must implement the IUnknown interface, which is done by creating a UUID representing IUnknown. In all cases wherever IUnknown is used, whether it is being used by a process trying to access the IUnknown interface in a component, or by a component implementing the IUnknown interface, it is always referenced by the same identifier: 00000000-0000-0000-C000-000000000046.


And the official definition of a UUID is found here (http://www.itu.int/ITU-T/asn1/uuid.html#what):
What is a UUID?
A UUID (Universally Unique Identifier) can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network, particularly (but not necessarily) as part of an ASN.1 object identifier (OID) value, or in a Uniform Resource Name (URN). UUIDs are an octet string of 16 octets (128 bits). The 16 octets can be interpreted as an unsigned integer encoding, and the resulting integer value can be used as a subsequent arc of {joint-iso-itu-t uuid(25)} in the OID tree. This enables users to generate OIDs without any registration procedure.
UUIDs forming a component of an OID are represented in ASN.1 value notation as the decimal representation of their integer value, but for all other display purposes it is more usual to represent them with hexadecimal digits with a hyphen separating the different fields within the 16-octet UUID. This representation is defined in ITU-T Rec. X.667 | ISO/IEC 9834-8.
Example: f81d4fae-7dec-11d0-a765-00a0c91e6bf6 is the hexadecimal notation that denotes the same UUID as 329800735698586629295641978511506172918 in decimal notation.
UUIDs are also known as Globally Unique Identifiers (GUIDs), but this term is not used in ITU-T Rec. X.667 | ISO/IEC 9834-8. UUIDs were originally used in the Network Computing System (NCS) and later in the Open Software Foundation's Distributed Computing Environment (DCE). ISO/IEC 11578 "Remote procedure Call (RPC)" contains a short definition of some (but not all) of the UUID formats specified in ITU-T Rec. X.667 | ISO/IEC 9834-8 which is consistent with all these earlier specifications.
If generated according to one of the mechanisms defined in ITU-T Rec. X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be different from all other UUIDs generated before 3603 A.D., or is extremely likely to be different (depending on the mechanism chosen). The UUID generation algorithm specified in this standard supports very high allocation rates: 10 million per second per machine if necessary, so UUIDs can also be used as transaction IDs.
No centralized authority is required to administer UUIDs but central registration of self-generated UUIDs and automatic generation of UUIDS (using the algorithm defined in ITU-T Rec. X.667 | ISO/IEC 9834-8) are provided at the top of this web page. Centrally generated UUIDs are guaranteed to be different from all other UUIDs centrally generated. Registered UUIDs are guaranteed to be different from all other registered UUIDs.


I am sure you will agree that by enforcing sequentiality you remove the degree of freedom guaranteed by the randomness which is integral to the definition of a UUID, and hence a GUID.

The risk is that by generating sequential 'GUIDs' you may either inadvertently arrive at a value that arises randomly from some other source combination, or simply exhaust your supply of possible values long before 3400 AD :)

Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA

ENTIRE THREAD

Primary Key Posted by Aaron Hathaway @ 8/24/2007 10:25:32 PM
RE: Primary Key Posted by Borislav Borissov @ 8/24/2007 10:46:52 PM
RE: Primary Key Posted by Aaron Hathaway @ 8/24/2007 11:09:39 PM
RE: Primary Key Posted by Ken Murphy @ 8/25/2007 1:47:10 AM
RE: Primary Key Posted by Barbara Peisch @ 8/25/2007 5:01:14 AM
RE: Primary Key Posted by Mike Yearwood @ 8/26/2007 2:02:59 AM
RE: Primary Key Posted by Andy Kramek @ 8/27/2007 1:01:44 PM
RE: Primary Key Posted by Mike Yearwood @ 8/27/2007 3:37:30 PM
RE: Primary Key Posted by Andy Kramek @ 8/27/2007 5:57:08 PM
RE: Primary Key Posted by Mike Yearwood @ 8/27/2007 7:55:38 PM
RE: Primary Key Posted by Andy Kramek @ 8/27/2007 8:31:58 PM
RE: Primary Key Posted by Mike Yearwood @ 8/28/2007 2:33:15 PM
RE: Primary Key Posted by Andy Kramek @ 8/28/2007 2:48:25 PM
RE: Primary Key Posted by Ken Murphy @ 8/28/2007 3:48:57 PM
RE: Primary Key Posted by Andy Kramek @ 8/28/2007 5:06:25 PM
RE: Primary Key Posted by Ken Murphy @ 8/28/2007 6:03:54 PM
RE: Primary Key Posted by Andy Kramek @ 8/28/2007 9:10:24 PM
RE: Primary Key Posted by Ken Murphy @ 8/28/2007 10:48:19 PM
RE: Primary Key Posted by Andy Kramek @ 8/29/2007 12:41:37 PM
RE: Primary Key Posted by Ken Murphy @ 8/29/2007 12:58:20 PM
RE: Primary Key Posted by Mike Yearwood @ 8/29/2007 7:49:54 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/25/2016 7:09:30 PM
RE: Primary Key Posted by Tore Bleken @ 7/25/2016 8:03:30 PM
RE: Primary Key Posted by Hugo Ranea @ 8/29/2007 9:34:10 PM
RE: Primary Key Posted by Daniel Hofford @ 8/29/2007 11:46:07 PM
RE: Primary Key Posted by Mike Yearwood @ 7/24/2016 1:53:22 PM
RE: Primary Key Posted by Benny Thomas @ 7/24/2016 2:30:24 PM
RE: Primary Key Posted by Mike Yearwood @ 7/24/2016 3:20:23 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/25/2016 7:16:41 PM
RE: Primary Key Posted by Mike Yearwood @ 7/25/2016 8:49:05 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/25/2016 7:04:07 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/25/2016 6:59:58 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/25/2016 7:00:06 PM
RE: Primary Key Posted by Koen Piller @ 7/25/2016 11:37:27 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/26/2016 8:01:52 PM
RE: Primary Key Posted by Mike Yearwood @ 7/26/2016 8:59:17 PM
RE: Primary Key Posted by Gene Wirchenko @ 7/27/2016 7:02:39 PM
RE: Primary Key Posted by Paul Gibson @ 7/27/2016 12:21:25 PM