- 安装
- # wget http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz
-
# tar zxvf mysqlsla-2.03.tar.gz
-
# cd mysqlsla-2.03
-
# perl Makefile.PL
-
# make
-
# make install
测试
[root@ldc2095 mysqlsla-2.03]# mysqlsla /var/lib/mysql/ldc2095-slow.log
Auto-detected logs as slow logs
Report for slow logs: /var/lib/mysql/ldc2095-slow.log
6.03k queries total, 238 unique
Sorted by 't_sum'
Grand Totals: Time 944.15k s, Lock 731 s, Rows sent 129.99M, Rows Examined 1.14G
______________________________________________________________________ 001 ___
Count : 260 (4.31%)
Time : 684598.79344 s total, 2633.072282 s avg, 2.767179 s to 6081.362266 s max (72.51%)
95% of Time : 605719.49628 s total, 2452.305653 s avg, 2.767179 s to 6045.503342 s max
Lock Time (s) : 211.046 ms total, 812 µs avg, 193 µs to 52.139 ms max (0.03%)
95% of Lock : 105.618 ms total, 428 µs avg, 193 µs to 1.866 ms max
Rows sent : 1.18k avg, 236 to 1.20k max (0.24%)
Rows examined : 790.89k avg, 4.06k to 810.41k max (18.10%)
Database :
Users :
dev@ 172.16.215.75 : 100.00% (260) of query, 98.57% (5944) of all users
Query abstract:
SET timestamp=N; SELECT /* smw::getqueryresult N.N.N.N */ DISTINCT t0.smw_id AS id,t0.smw_title AS t,t0.smw_namespace AS ns,t0.smw_iw AS iw,t0.smw_sortkey AS sortkey,t0.smw_sortkey FROM smw_ids AS t0 INNER JOIN smw_ids AS t1 ON t0.smw_id=t1.smw_id WHERE t1.smw_namespace='S' ORDER BY t0.smw_sortkey ASC LIMIT N;
Query sample:
SET timestamp=1309528970;
SELECT /* SMW::getQueryResult 66.249.71.8 */ DISTINCT t0.smw_id AS id,t0.smw_title AS t,t0.smw_namespace AS ns,t0.smw_iw AS iw,t0.smw_sortkey AS sortkey,t0.smw_sortkey FROM `smw_ids` AS t0 INNER JOIN `smw_ids` AS t1 ON t0.smw_id=t1.smw_id WHERE t1.smw_namespace='1180' ORDER BY t0.smw_sortkey ASC LIMIT 1201;