This the the easiest and fastest way to optimize your wordpress site database without using any plugins:
WordPress has a tool that allows you to repair and optimize your database. You can find out more about this tool in the Automatic Database Optimizing section of the WordPress.org guide on wp-config.php.
To use the optimization tool, you first need to add this line to your website wp-config.php file.
Once you have added the above line to wp-config.php and saved the file, you can access the optimization tool at http://www.yourwebsite.com/wp-admin/maint/repair.php.
The WordPress optimization tool lets you repair your database, or repair and optimize your database.
The optimization tool will attempt to repair each database table. From time to time, the script may not be able to repair certain tables.
WordPress will attempt to repair each database table.
If you do not successfully repair your database in the first attempt, simply run the optimization tool again.
If there are any problems during the repair, run the repair script again.
If you select “Repair and Optimize Database”, WordPress will optimize every table that has not already been optimized.
The tool will optimize any table that has not already been optimized.
You do not need to be logged in to run the WordPress optimization tool. The downside to this is that anyone can access your script and execute it. Due to this, you need to remove the WP_ALLOW_REPAIR line from your wp-config.php file after you have used the optimization tool.