I have got three tables that are supposed to be joined, the query looks like this:
select distinct a.job
from a
join b on a.job=b.id
join c on c.id =a.path
where c.path like '//depot/a/b/c/d/MARSR_CL286896_297899/%';
This query will always timeout. However, if I change the path comparison to some condition else, the query just run perfectly, for example:
select distinct a.job
from a
join b on a.job=b.id
join c on c.id =a.path
where c.path like '//depot/a/b/c/d/%';
Considering the difference of the path parameter, will the numbers and underscores the culprit that slows the statement? I have created index for the 'path' field
result of 'explain' command
1 SIMPLE b index PRIMARY job 62 73580 Using index; Using temporary
1 SIMPLE a ref path,job job 8 b.id 153
1 SIMPLE c eq_ref PRIMARY,path PRIMARY 8 a.path 1 Using where