title: PHP and MySQL - Lot of queries causing timeout of 300 seconds
body: <p>I got a PHP application that causes performance issues with MySQL. What happens is this: After the database entries extend a certain amount; it starts to randomly timeout the PHP page for 300 seconds.</p>
  
  <p>I know I have to rewrite my code, since it is messy, out-dated, and I'm basically running a lot of queries which could be much more efficient.</p>
  
  <p>But, I'm very curious what is able to cause this, and if there is a short-term solution for this. The php application works perfectly, but after browsing some pages with the results of the query behaving like it should, sometimes the load-time changes to 300 seconds. After which the page with database results show perfectly. After that I'm able to view some pages again, after which the process randomly starts over. During the 300 seconds the page is loading, the SQL processlist shows the command "Sleep" for the full loading time, with no query attached.</p>