Chinaunix首页 | 论坛 | 博客
  • 博客访问: 128883
  • 博文数量: 89
  • 博客积分: 2580
  • 博客等级: 少校
  • 技术积分: 775
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-05 20:09
文章分类

全部博文(89)

文章存档

2009年(89)

我的朋友

分类: Mysql/postgreSQL

2009-09-23 13:02:25


# NOTE: depending on your version of MySQL
## This example is for mysql 5.4


Shell> for x in var=`cat mysql.log |grep Connect |awk '{print $2}' |cut -d: -f3`; do echo ${var:2:50} >> out.txt; done


I now have all of the connection ids for the database I want to benchmark. From here I need to parse through the mysql.log (the general log) to get the queries that I would like to run with mysqlslap. Here goes:


Shell> for x in `cat ./out.txt`; do cat mysql.log | awk -v x="$x" '{ if ( $1 == x ) { printf("%s ;\n",$0,x) } }' $1; done |awk -FQuery '{print $2 “ ;”}' |grep –v “INSERT” >> myqueries.txt


阅读(580) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~