Оптимизация mysql запроса с 5 таблиц

я опять с вопросом про оптимизацию MYSQL 5.6 был у меня такой запрос, работает прекрасно и быстро

SELECT card, pos, shift_open, local_number, 
       date, amount, tori.item, tori.quantity, 
       tori.receipt_header
FROM trm_out_receipt_header torh   
INNER JOIN trm_out_receipt_item tori  ON (torh.id=tori.receipt_header and torh.cash_id = tori.cash_id) 
LEFT JOIN trm_out_receipt_payment torp ON (torh.id=torp.receipt_header and torh.cash_id=torp.cash_id) 
where torh.card IN ('229456', '229455') 
group by date

К ним добавилось еще 2 таблицы, и запрос вообще более получаса делается, естественно таблица items_in_dbo весит кучу, пробовал и outter, right и просто JOIN результат один и тот же dbfiddle

SELECT card, pos, shift_open, local_number, 
       date, amount, tori.item, tori.quantity, 
       tori.receipt_header, igid.tree, igid.id_group 
FROM trm_out_receipt_header torh   
INNER JOIN trm_out_receipt_item tori  ON (torh.id=tori.receipt_header and torh.cash_id = tori.cash_id) 
LEFT JOIN trm_out_receipt_payment torp ON (torh.id=torp.receipt_header and torh.cash_id=torp.cash_id) 
LEFT JOIN items_in_dbo iid ON (iid.item_id = tori.item)
LEFT JOIN item_groups_in_dbo igid ON (igid.id_group = iid.id_group)
where torh.card IN ('229456', '229455') 
group by date

Ответы (0 шт):