Bertrand
If you are interested in refactoring existing code, I would recommend that you first control the use of your CPU and memory while reporting. Will you block your SQL server or block Apache (what happens if PHP code is inserted into the system)?
I was working on a project that initially strangled MySQL so much that we had to reorganize the entire process of creating the report. However, when we were done, the download was just ported to Apache (via more complex PHP code). Our final decision was to reorganize the database design to provide better performance for reporting functions and use PHP to take up the slack in what we couldn't do initially in MySQL.
Depending on the nature of the reports, you might consider denormalizing the data that is used for the reports. You might even consider creating a second database, which serves as a data warehouse, and is designed for OLAP principles, not OLTP principles. You can start on Wikipedia for a general explanation of OLAP and data warehousing.
However, before you start looking at serious refactoring, you have confirmed that your environments are quite similar by looking at phpinfo (); for PHP and SHOW VARIABLES; in MySQL?
Noah goodrich
source share