From: http://yueliangdao0608.blog.51cto.com/397025/312602/
mk-query-digest –select Query_time,Lock_time,Rows_sent,Rows_examined –processlist h=localhost,u=root,p=password
use Ctrl+C to stop.
OPTION:
–select
–processlist DSN
From: http://yueliangdao0608.blog.51cto.com/397025/312602/
mk-query-digest –select Query_time,Lock_time,Rows_sent,Rows_examined –processlist h=localhost,u=root,p=password
use Ctrl+C to stop.
OPTION:
–select
–processlist DSN
Maatkit 是 Baron Schwartz 的另一项创造,是一系列命令行工具的集合。所有工具都是用 Perl 编写的,用来补充 MySQL 未能提供的的那些重要功能。可以在 http://www.maatkit.org/ 上找到它们,包括了分析工具和其它一些小功能。
这些分析工具的其中一个是 mk-query-profiler,当它检测服务器状态变量时能够执行查询,并会打印出一个具体且易读的关于查询前后的系统状态变量差异情况的报告。这份报告能使查询有更深的理解,而不仅限于在它执行的时候。
可以将查询通过管道传入 mk-query-profiler 的标准输入口,指定一个或多个查询文件,或者仅仅是要求它检测服务器而不运行任何查询(当运行一个外部应用时,这种方式会用得上)。也能让它运行 shell 命令而不是查询。
mk-query-profiler 的报告分成好几个段落。默认的情况下,这个报告打印出的是一批摘要信息,但是,也可以得到一份包含了每一个查询或者所选择的查询的报告,然后加载到 mk-profile-compact 的辅助工具里方便地进行比较。
以下是这份报告的主要段落:
总而言之,这份报告可以细致地描述出服务器正在处理多少种类型的任务,这比仅仅是衡量查询所需要的时间要有价值得多。例如。可以帮助筛选这样两个查 询:它们在第负载时,在一个小数据集上都用几乎相等的时间完成了查询;但是,当使用到的数据量变到很大的时候,或者说在高负载的时候,它们的表现就有了巨 大的差异。它也可以被用来验证优化是否起到了作用,在这种应用环境下,它就像是一个微型的基准测试工具。
在这个工具里还有另外几种分析工具:
mk-visual-explain
mk-duplicate-key-checker
mk-deadlock-logger
mk-heartbeat
mk-archiver
mk-find
mk-parallel-dump
mk-parallel-restore
mk-show-grants
mk-slave-delay
mk-slave-prefetch
mk-slave-restart
mk-table-checksum
mk-table-sync
check the link: http://www.percona.com/doc/percona-server/5.5/installation.html
1. wget *.d3b
2. dpkg -i *.deb
3. apt-get -f install
http://www.markhansen.co.nz/javascript-optional-parameters/
Import is:
function connect(hostname, port, method) {
hostname = hostname || "localhost";
port = port || 80;
method = method || "GET";
}
The short-circuit OR operator ||
returns the left side if the left argument is truthy (evaluates to true
in conditionals), otherwise it checks if the right argument is truthy, returning it. We can use this shortcut because undefined
is falsy: in conditionals, undefined
evaluates to false
.
This shortcut approach is a very common idiom, but it does have a disadvantage: You can’t use for any argument that could accept a falsy value: false
, 0
, null
, undefined
, the empty string ""
, and NaN
.
Using the ||
shortcut will override any falsy input value. If you expect a falsy value, you must explicitly check for argument === undefined
.