기존 쿼리
select
i.idx as idx
, i.address as address
, i.address_a as addressA
, i.address_n as addressN
, i.created_at as createdAt
, di.title
from (
select
no
, pk
from config c
where c.pk = 27
) c
left outer join delivery_info di on di.no = c.pk
left outer join info i on c.no = i.pk
order by i.created_at desc
limit 10;
튜닝한 쿼리
select
i.idx as idx
, i.address as address
, i.address_a as addressA
, i.address_n as addressN
, i.created_at as createdAt
, di.title
from info i
left join config c on c.no = i.pk
left join delivery_info di on di.no = c.pk
where i.pk in (
select
no
from delivery_info di
where di.configPk = 27
)
order by i.created_at desc
limit 10;