Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2007, 08:57 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use of UNIQUEIDENTIFIER

G'Day Thearon,

Firstly I must heap the sunshine and praise on your book, your writing style is 10000% tailored the way I best learn and I powered through the first 13 chapters in a week. I have not looked at 14 - 16 yet and probably will not for a long time as they are not in the area that I am trying to learn just yet.

Hopefully this is not a stupid question and you will have a fairly simple answer. I am reviewing an existing project (modeled on an existing DOS application that I am trying to move out of antiquity and into today) and looking at my data design. In your book you made fairly heavy use of the UNIQUEIDENTIFIER data type and I was wondering why this was the case, given that it is 16 bytes and would have a significant impact on database size with a lot of transactions.

The project I am working on is very data driven and there are many internal relationships between the tables that utilise key unique values to bind this relationship. These are currently CHAR with lengths of 8 to 10 characters depending on their use and I was wondering if there was any significant advantage of UNIQUEIDENTIFIER over CHAR to handle this.

Hope you can help with your reasoning so I can make an informed decision on my database structures.


Graham Hillier
 
Old March 9th, 2007, 06:31 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Graham,

Thank you very much for the praise and I'm glad my book is of use to you.

I've worked on various database applications over the years and have seen a lot of problems using an IDENTITY column as a primary key field for tables. Even when just an INTEGER data type is used for the primary key there is still a lot of potential for duplicate values to be entered. This is especially true in high transaction databases.

I find that a UNIQUEIDENTIFIER works very well as a duplicate GUID will never be generated. Using a GUID also sets up your database to be replicated down the line if the need arises. When working with replicated data, a UNIQUEIDENTIFIER must be used to unquiely identify each row of data.

I've not see a performance decrease using a UNIQUEIDENTIFIER and actually think it will offer better performance over a CHAR data type.

Thearon
 
Old March 9th, 2007, 01:52 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

G'Day again Thearon,

Thanks for the quick response. Those are areas I had not considered, Primary Key and Replication, but I suppose there is a distinct possibility that I might need Replication down the track. I will review my tables and use UNIQUEIDENTIFIER in them.

Thanks again,


Graham Hillier





Similar Threads
Thread Thread Starter Forum Replies Last Post
Is uniqueidentifier is always unique ? vinod_yadav1919 SQL Server 2000 4 May 30th, 2008 11:31 AM
Uniqueidentifier to Integer Conversion mp01 BOOK: Beginning VB.NET Databases 2 August 8th, 2005 06:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.