Tables Indexes

Tables Indexes, a forum discussion on Jojo CMS. Join us for more discussions on Tables Indexes on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS

Lead Developer


29 Sep 2010
Posts: 67

Jojo doesn't create indexes on many tables by default when you installed it. Most of us probably haven't bothered to add any either.

This does have a significant performance impact on a server under load, or is just a waste of electricity on a server that has yet to show any performance impact.

We have a lot of sites running on our server and it didn't seem smart to go through each database and add indexes to tables manually.

So here's my script for do it for me:

You'll need to configure a few bits.
/* Only work if the page is being requested from one of these IP addresses */
$allowIPs = array('');

and create a dbconnect.php containing
$db = new mysqli('', 'username', 'really strong password', 'anydatabase');
where username has access to all the tables you and to check.

/* Safe mode doesn't make any changes, just outputs the SQL it would have run */
$safemode = true;

Safe mode on doesn't run the alter table statement, turn it off and it does and lets you know which ones worked and which ones failed.

The $indexes array is just the indexes that my mysql slow query log has indicated would make the largest difference. There are many more to add and I will add these as I see fit based on log analysis.

Please feel free to post other tables/indexes here for others.
Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply

You need to Register or Log In before posting on these forums.