# Mysql query performance issue

**URL:** <https://forum.kirupa.com/t/mysql-query-performance-issue/293961>\
**Category:** Uncategorized\
**Created:** [August 6, 2009, 9:40am UTC](https://forum.kirupa.com/t/mysql-query-performance-issue/293961 "2009-08-06T09:40:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilbertsavier](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@gilbertsavier](https://forum.kirupa.com/u/gilbertsavier)\
**Post date:** [August 6, 2009, 9:40am UTC](https://forum.kirupa.com/t/mysql-query-performance-issue/293961/1 "2009-08-06T09:40:43Z")

</div>

i All,

I am using testlink tool with mysql ( [teamst.org/phpBB2/viewtopic.php?t=1938](http://teamst.org/phpBB2/viewtopic.php?t=1938) ).

I have found that this query takes 54 secs to fetch data…which is not acceptable…  
I am not conversant with mysql tuning…

SELECT  
NHB.parent\_id AS testsuite\_id, NHA.parent\_id AS tc\_id,  
NHB.node\_order AS z, T.tcversion\_id AS tcversion\_id,  
T.id AS feature\_id, TCV.active,  
E.id AS exec\_id, E.tcversion\_id AS executed,  
E.testplan\_id AS exec\_on\_tplan, UA.user\_id,UA.type,  
UA.status, UA.assigner\_id,  
COALESCE(E.status,‘n’) AS exec\_status  
FROM  
nodes\_hierarchy NHA JOIN nodes\_hierarchy NHB ON NHA.parent\_id = NHB.id  
JOIN testplan\_tcversions T ON NHA.id = T.tcversion\_id  
JOIN tcversions TCV ON NHA.id = TCV.id  
JOIN executions E ON (NHA.id = E.tcversion\_id AND E.testplan\_id=T.testplan\_id AND E.build\_id=21 )  
LEFT OUTER JOIN user\_assignments UA ON UA.feature\_id = T.id  
WHERE T.testplan\_id=30397  
AND (UA.type=1 OR UA.type IS NULL)  
AND E.status=‘p’  
AND E.id IN ( SELECT MAX(id) FROM executions WHERE testplan\_id=30397 GROUP BY tcversion\_id,testplan\_id )  
ORDER BY testsuite\_id,NHB.node\_order,tc\_id,E.id ASC;

Any help to bring down the sql execution time would be highly appreciated.
