Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add compound index on modTemplateVarResource #8489
This issue is actual only for MySQL prior to 5.1. I've tested on 5.0.96, 5.1.66 and 5.5.29.
For fix it you have to update MySQL scheme this way:
ALTER TABLE `modx_site_tmplvar_contentvalues` ADD INDEX `tv_cnt` (`tmplvarid` ASC, `contentid` ASC);
Also this index makes such queries about 30% faster on MySQL 5.1.66 and 5.5.29
I wish this fix will be included in further versions of modx.
Not having a compound index on the tmplvarid and contentid fields in modTemplateVarResource is causing extremely slow queries on larger datasets, especially with older versions of MySQL. Adding this index improves efficiency of many TV related queries in the core on all versions of MySQL.