hi,
i’ve just been looking at several tables - i think it’d be easy to make them more efficient:
document_groups
site_tmplvar_contentvalues
both of the above have primary keys called ’id’. unless i’ve missed something in the code, it’d be much more efficient to use composite primary keys. this would have a dual benefit of removing a ton of useless information, and it would speed up retrieval of records via selects, and probably other CRUD operations too.
document_groups should have a composite pk of (document, document_group), with an extra index on document_group.
site_tmplvar_contentvalues should have a composite pk of (contentid, tmplvarid)
i checked the revolution code and these fields are represented by children of xPDOSimpleObjects.
it should be simple to change them to xPDOObjects, and apply alteration to a user’s database during an upgrade of evolution to revolution which drops these columns and applies a new composite primary key.
would there be any problem making these changes? any thoughts?
-
MODX Staff
- 10,725 Posts
Agreed, and if you notice, the new intersection tables in Revo do use compound primary keys where appropriate. We’ll bring them all in-line for 2.1 when we also address the unix timestamp fields, introduce modContent, modRevision, and some supporting classes/tables, and other changes that can be better managed once we get everyone using the new model API (i.e. fewer or more isolated dependencies on direct SQL calls).