This query:
select id
from user u
where u.account_id = 600
returns:
61,71,68,69,70,118,116,117,248,381,384,325,265,393
and it works really fast. This query:
select *
from logs l
where l.user_id in
(
61,71,68,69,70,118,116,117,248,381,384,325,265,393
)
works really fast too. But why is this query:
select *
from logs l
where l.user_id in
(
select id
from user u
where u.account_id = 600
)
works very slow (Im getting timeout). Why putting explicit data is solving the problem?