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 `item_properties` ADD INDEX `item_properties_idx_prop_id_item_id` (`prop_id`,`item_id`);
SELECT
items.stuff
FROM
items
WHERE
EXISTS (
SELECT
*
FROM
item_properties
WHERE
item_properties.prop_id = 123
AND item_properties.item_id = items.id
)
AND EXISTS (
SELECT
*
FROM
item_properties
WHERE
item_properties.prop_id = 456
AND item_properties.item_id = items.id
)
AND NOT EXISTS (
SELECT
*
FROM
item_properties
WHERE
item_properties.prop_id = 789
AND item_properties.item_id = items.id
)
AND NOT EXISTS (
SELECT
*
FROM
item_properties
WHERE
item_properties.prop_id = 101
AND item_properties.item_id = items.id
)