Composite primary keys can be useful in multi-tenant applications. For example, 
if you app has discrete users that don't need to cross talk often. By usimg 
composite keys you can make the 'identifier' for a record the accountid + 
thingid. This allows each user to have thingid=1 if you wanted. Composite keys 
are also great for belongstomany joint tables.

If you are using Mysql there are some side benefits as well. MySql stores rows 
on disk based on the primary key. When yoou use composite keys mysql will 
cluster data for an account close together. This can make read queries faster 
as there are fewer disk seeks used to find the data for a given account.

-mark

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to