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 `attribute_values` ADD INDEX `attribute_values_idx_value_id_id` (`value_id`,`ID`);
ALTER TABLE `products` ADD INDEX `products_idx_id` (`ID`);
SELECT
DISTINCT P.*
FROM
attribute_product_values APV
INNER JOIN
products P
ON P.ID = APV.product_id
LEFT JOIN
attribute_values AV
ON AV.ID = APV.attribute_value_id
AND AV.value_id = 6
LEFT JOIN
attribute_values AV2
ON AV2.ID = APV.attribute_value_id
AND AV2.value_id = 3
WHERE
AV.ID IS NOT NULL
OR AV2.ID IS NOT NULL