I’ve optimized my queries and they all run faster than 0.6 seconds. However, sometimes they can take 2 or 3 seconds.
I’m using a shared server, however the server is only used by a static html site and my database. I’ve added functionality so I get an email if a query takes longer than 0.6 seconds. I get about 20 to 30 a day. The site gets around 800 hits a day. So the queries are ok most of the time.
I’m looking for a way in PHP using mysql that i can find out if I’m running other queries aka if the server is busy.
I want to add something in my php so I can add this to my slow query email
Any ideas ?
Regarding your update “I want to add something in my php so I can add this to my slow query email”:
execorshell_execto runtop,uptimeand other system commands that will give you an idea of the server’s state at the time of the slow queries. Save the output to a string and add it to your mails.