UUIDs are generated in lib/Cake/Utility/String.php, and are supposed to conform to http://www.ietf.org/rfc/rfc4122.txt. Because a UUID is independent of the database that it might be stored in, and by definition, it should be unique across all databases.
For performance reasons, you might be better off with Option 2.
For performance reasons, you might be better off with Option 2.
With option 1, you wouldn't be able to use AUTO_INCREMENT, and you may have to do some tricky stuff to implement a primary key that is neither an auto_incremented integer, nor a uuid. It may not even be possible, since any mention of a string based primary key may be assumed to be an UUID. I've not used UUID in production, so someone else may have to chime in, but it sounds like UUID is what you might be after.
Regards
Reuben Helms
On Saturday, 3 August 2013 17:45:29 UTC+10, Sanjeev Divekar wrote:
-- On Saturday, 3 August 2013 17:45:29 UTC+10, Sanjeev Divekar wrote:
Hello,I am developing an application for 5 different locations.Each location will have it's own mysql server and application will manually copy each record to Master Server which is VPS.Please suggest me best way to use Primary Key.Option 1.Location based Primary key e.g. Location 1 will have A001 Record and Location 2 will have B001Option 2.uuid. I am confused that UUID will be unique across all servers?Thanks & Regards,Sanjeev Divekar
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment