This plugin by matthew price allows you to have your WordPress tables to be optimized on a schedule. It uses the WordPress Database Class to do the work, and you can set the number of days in between optimizations.
You will then have a new menu option under the Tools Menu where you can set the number of days in between optimizations. You can also view the last time the database was optimized.
Plugin homepage: http://www.countingrows.com/wp-database-optimizer/