原文地址: http://blog.csdn.net/k_scott/article/details/8804384
分类:
MySQL2013-04-15 16:03 861人阅读
评论(1)
举报
1、首先查看是否开启profiling功能
-
SHOW VARIABLES LIKE '%pro%';
或者
2、开启profiling
3、执行sql语句
例如:
-
SELECT
-
table_schema AS 'Db Name',
-
ROUND( SUM( data_length + index_length ) / 1024 / 1024, 3 ) AS 'Db Size (MB)',
-
ROUND( SUM( data_free ) / 1024 / 1024, 3 ) AS 'Free Space (MB)'
-
FROM information_schema.tables
-
GROUP BY table_schema ;
4、查看结果
-
SHOW profile ALL FOR QUERY 94;
94是查询ID号。
SHOW profiles语法:
-
SHOW PROFILE [type [, type] … ]
-
[FOR QUERY n]
-
[LIMIT row_count [OFFSET offset]]
-
-
type:
-
ALL
-
| BLOCK IO
-
| CONTEXT SWITCHES
-
| CPU
-
| IPC
-
| MEMORY
-
| PAGE FAULTS
-
| SOURCE
-
| SWAPS
-
阅读(1329) | 评论(0) | 转发(0) |