explain analyze
select STRAIGHT_JOIN
c.name as category
, sum(case when i.store_id = 1 then 1 end) as store_1
, sum(case when i.store_id = 2 then 1 end) as ystore_2
from category c
join film_category fc IGNORE INDEX(primary, fk_film_category_category) on c.category_id = fc.category_id
join inventory i IGNORE INDEX(idx_fk_film_id, idx_store_id_film_id) ON i.film_id = fc.film_id
group by c.name
;
show status like '%cost';