# MySQL:Copying to tmp table

**URL:** <https://forum.shopware.com/t/mysql-copying-to-tmp-table/44692>\
**Category:** International (English Only)\
**Tags:** general\
**Created:** [21. März 2017 um 15:10 UTC](https://forum.shopware.com/t/mysql-copying-to-tmp-table/44692 "2017-03-21T15:10:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![testusernetwork1](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@testusernetwork1](https://forum.shopware.com/u/testusernetwork1)\
**Post date:** [21. März 2017 um 15:10 UTC](https://forum.shopware.com/t/mysql-copying-to-tmp-table/44692/1 "2017-03-21T15:10:55Z")

</div>

Hai.,

I have faced server Hanging becase of the following.  
Please check the below image

**[SELECT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/select.html)&nbsp;a.id&nbsp;as&nbsp;articleID,&nbsp;a.name&nbsp;as&nbsp;articleName,&nbsp;[IF](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html#function_if)(s.id,&nbsp;2,&nbsp;0)&nbsp;+&nbsp;– Similar article&nbsp;[IF](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html#function_if)(s2.id,&nbsp;1,&nbsp;0)&nbsp;– Same category&nbsp;as&nbsp;relevance&nbsp;FROM&nbsp;s\_articles&nbsp;a&nbsp;INNERJOIN&nbsp;s\_articles\_categories\_ro&nbsp;ac&nbsp;ON&nbsp;ac.articleID=a.id&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;ac.categoryID&nbsp;=&nbsp;3&nbsp;INNERJOIN&nbsp;s\_categories&nbsp;c&nbsp;ON&nbsp;c.id&nbsp;=&nbsp;ac.categoryID&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;c.active&nbsp;=&nbsp;1&nbsp;[LEFT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_left)&nbsp;JOINs\_articles\_avoid\_customergroups&nbsp;ag&nbsp;ON&nbsp;ag.articleID=a.id&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;ag.customergroupID=1[LEFT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_left)&nbsp;JOIN&nbsp;s\_articles&nbsp;o&nbsp;ON&nbsp;o.id=3076&nbsp;[LEFT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_left)&nbsp;JOIN&nbsp;s\_articles\_similar&nbsp;s&nbsp;ONs.articleID=o.id&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;s.relatedarticle=a.id&nbsp;[LEFT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_left)&nbsp;JOIN&nbsp;s\_articles\_categories\_ro&nbsp;s1ON&nbsp;s1.articleID=o.id&nbsp;[LEFT](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_left)&nbsp;JOIN&nbsp;s\_articles\_categories\_ro&nbsp;s2&nbsp;ONs2.categoryID=s1.categoryID&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;s2.articleID=a.id&nbsp;WHERE&nbsp;a.active&nbsp;=&nbsp;1&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)ag.articleID&nbsp;[IS](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html#operator_is)&nbsp;NULL&nbsp;[AND](http://sql3.upware.de/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/logical-operators.html#operator_and)&nbsp;a.id!=3076&nbsp;GROUP&nbsp;BY&nbsp;a.id&nbsp;ORDER&nbsp;BY&nbsp;relevance&nbsp;DESC&nbsp;LIMIT&nbsp;4**

The above select Query run many more time in PhpMyAdmin.

Please help me in this

Thanks in Advance
