Optimize your database!

Ever notice your database-driven sites getting slow to load, or sticky? Maybe the comments take forever to post, or the admin panel seems wonky (I believe that’s the technical term). You may need to optimize your database.

This is not as scary as it sounds:

First of all, backup your database! That way, you’re protected if anything goes wrong.

1. Go into your site control panel (usually at http://mysite.com:2082)
2. Click MySql Databases. Scroll down to the bottom and click on a link that says “phpmyadmin”
3. Select your database from the drop-down box in the left sidebar.
4. Look in the main panel. At the bottom of the big chart (your tables), there’s a link that says “Check All”. Click it. The boxes down the left side of the big chart should all have little checkmarks now.
5. Near the “Check All” link is a drop down box. Click on it and select “optimize table”. Make sure you don’t hit “Drop” or “Empty”, which would more or less delete the whole thing. Fortunately, they’re nowhere near “optimize”, so it’s not an easy mistake to make (or I’m sure I’d have made it by now). But if you backed up your database, even an accidental deletion is correctable.

Do this whenever you notice your MySql databases seem a little slow or funky, and you should be able to keep your php-driven sites running much more smoothly.

Related posts:
  1. Preventing MySQL Database Crashes
  2. Watch out for database failures
  3. How to change a database table name
  4. Is it that hard to load a php site?
  5. How to merge blogs together

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>