Im running PHP and MySQL on Linux Fedora. There is a table with 2,525,978 number of rows. I was querying and generating a report on webpage based on this table. It runs slowly. So I created another table with 283,661 number of rows which is about the data within the latest 7 days. It seems generating the report faster, but sometimes it runs slowly still. I know there are many reasons could cause the execution slow, but I don't know how to troubleshoot it and know where exactly why at a certain time, the webpage report is generating slowly.
Does someone have some ideas about this? Thanks.