Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 8th, 2007, 08:57 PM
Registered User
 
Join Date: Mar 2007
Location: Sydney, NSW, Australia.
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
Reply With Quote
  #2 (permalink)  
Old March 9th, 2007, 06:31 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
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
Reply With Quote
  #3 (permalink)  
Old March 9th, 2007, 01:52 PM
Registered User
 
Join Date: Mar 2007
Location: Sydney, NSW, Australia.
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 09:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.