In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `products` ADD INDEX `products_idx_category` (`category`); ALTER TABLE `products` ADD INDEX `products_idx_id_horsepower` (`id`,`Horsepower`); ALTER TABLE `products` ADD INDEX `products_idx_id_manufactur_baldor` (`id`,`Manufacturer`,`Baldor`);
SELECT COUNT(`products`.`id`) FROM `products` WHERE `products`.`category` = 'Motors' AND EXISTS ( SELECT 1 FROM `products` AS products1 WHERE ( products1.`Horsepower` > 200 AND EXISTS ( SELECT 1 FROM `products` AS products12 WHERE ( products12.`Manufacturer` = products12."Baldor" ) AND ( products1.`id` = products12.`id` ) ) ) AND ( `products`.`id` = products1.`id` ) )