Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: open
When I see my server stat (CPU/MySql Memory usage) I see some of the sites using too much mysql and CPU.
Now, My problem is, I am not able to know what script or query is taking much time, when I ask my server people they give me a stat like this:
16597 27 18 0 185m 95m 4100 S 3.9 0.3 2815:34 mysqld
(2815 minutes on the same process)
Now I don't know what script is executing this sql and why it is taking so long?
Can you guys suggest any PHP tool by which i can see mysql process lists?
At the top of your script define two variables, $start_time and $current_time. Then do
$debug .= "start: $start_time ";
At various points in your script, append $debug with $current_time. This will define what's taking longest.
Supplement this with get_memory_usage() [us3.php.net], adding the values from it to your $debug.
At the end of the script,
echo '<!-- ' . $debug . ' -->';
And view source.
Most likely it's not mysql, it's probably an excessive select or loop in your program hanging it up.