I'd agree with Dominic. My company used to use GUIDs for OK and it's a pain in the arse. When you start getting hundreds of millions of records in the database, that varchar field for the GUID starts to take up a lot of space. Using it as the key for joins is trouble waiting to happen because now, you've got the GUID in not only one table, but MULTIPLE tables. Stick with the integer field for PK.
-----Original Message----- From: Dominic Watson [mailto:[EMAIL PROTECTED] Sent: Sunday, March 23, 2008 6:10 PM To: CF-Talk Subject: Re: Any "Gotcha's" in using CF UUID for db record primary key? Hi Rick, Personally, I would still use an auto-incrementing integer for the PK but have the UUID as a separate field with a unique constraint. Primary keys are not for making a single row unique but for facilitating the relational bit of relational databases (i.e. defining Foreign Key relationships). Having PKs as narrow as possible is better for performance when querying a database across relationships (i.e. using Joins, etc). Of course, as well as having the unique constraint on the GUID, your table should also define a constraint/index that logically defines what makes a row unique (i.e. a combination of account number and sort-code is a logical unique identifier for a bank account and should have a unique index or constraint - but not be a PK). HTH Dominic On 23/03/2008, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > Hi, all... > > I'm thinking about changing from using auto-incrementing integers to > CF-generated UUID's for primary keys in my mysql db's. > > Any drawbacks in doing that? > > The main reason I'm thinking about swapping is so I can eliminate the > two-step process of creating, say, a database record for a new Real > Estate development community for the textual information, and then > requiring a user to click a link with the record id in the URL to add > photos for the community. > > With a UUID, I can apparently create the UUID in advance and use it > for the primary key in the community and also for adding the photos, > all on the same page. > > This is my *first* time using a UUID, so don't leave anything out! > > Thanks, > > Rick > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301874 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

