MYSQL Statistics [closed]
I write a class to check some statisti开发者_运维百科cs and I don't know what mean the terms and If they are bad
$array = explode(" ", mysql_stat()); foreach ($array as $value){ echo $value . "<br />"; }
and output:
Uptime: 4520
Threads: 3
Questions: 295957
Slow queries: 0
Opens: 905
Flush tables: 1
Open tables: 32
Queries per second avg: 65.477
is something wrong ?
PS: any way to find out unclosed mysql connections ??
Thanks!
Are you having problems with database performance, or do you have another reason to write a statistics class? Without knowing what the values mean, they will never be very meaningful to you.
There's an article on techrepublic that helps explain some of the information; you can also check out the official documentation on server status variables here. That may be a good jumping-off point for you.
PS: Threads_connected will give you the number of currently open connections; is that what you're looking for?
The only meaningful metric of performance is user's experience of response time. If this metric indicates a problem use the statistic generated by the RDBMS to help investigate why response is slow.
The statistics by themselves mean nothing but when compared to loading and other details of your DB become meaningful. For instance 'Slow Queries 0' looks good but if you are running a large Data Warehouse 'Slow Queries 1000' might also be a good result.
Tracking the stats over time can be helpful to develop an understanding of normal load and then, when a problem is reported, you can compare to normal operation to determine what is wrong.
And as Problematic said, read up on the meaning of each stat so you can derive the information behind it.
精彩评论