And this is the info in the MySQL 5 docs that convinced me that LAST_INSERT_ID() was a safe means of retrieving id's, even with unlimited number of users working simultaneously...
============================================================================== The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned by the function to a given client is the first AUTO_INCREMENT value generated for most recent statement affecting an AUTO_INCREMENT column by that client. This value cannot be affected by other clients, even if they generate AUTO_INCREMENT values of their own. This behavior ensures that each client can retrieve its own ID without concern for the activity of other clients, and without the need for locks or transactions. ============================================================================== Am I wrong in my understanding? No locks, no transactions needed? Rick > -----Original Message----- > From: Greg Morphis [mailto:[EMAIL PROTECTED] > Sent: Monday, March 24, 2008 10:18 AM > To: CF-Talk > Subject: Re: Any "Gotcha's" in using CF UUID for db record primary key? > > But can't you put a <cflock /> around the query that inserts the > record and retrieves the last ID? > > On Mon, Mar 24, 2008 at 8:59 AM, Mark Fuqua <[EMAIL PROTECTED]> wrote: > > What if you have four concurrent users (or four hundred if your app get > > popular!), what happens if user two gets user three's id when she runs > > LAST_INSERT_ID()? > > > > That's the one of the only reasons I can see for using alternate keys. > > Whether it is a UUID created in Coldfusion or someother unique value...you > > KNOW what it is...everytime, because you set it, not the DB. > > > > Mark > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:301907 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

