Indexes are often forgotten
Now in my case most of these issues are good issues to have, it means we have huge amounts of data, which reflect on the huge amounts of users and users ( in our case ) == $
In it's most simplest form the routines worked fine for lets say 10k users, but on 300k users the performance suffers exponentially. When I urgently have to fix an issue like this I look to the database find one of the inner queries, take a quick look and apply an appropriate index to that table. The most recent example went from timing out after 5 mins, to taking 9 seconds. With time I'll re-write that section of code to either appropriately use joins, or if required a storedproc with UDF's but int he mean time ~2 mins of setting up an index made my users happy.
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.