mysqlsla分析慢查询,其中一个如下。
SET timestamp=N;这个的平均时间居然到2.25,这是为何?______________________________________________________________________ 003 ___
Count         : 3.04k  (5.29%)
Time          : 8051.368912 s total, 2.651093 s avg, 1.00013 s to 601.51557 s max  (1.03%)
  95% of Time : 6498.379461 s total, 2.252471 s avg, 1.00013 s to 4.939872 s max
Lock Time (s) : 205.106 ms total, 68 µs avg, 0 to 52.423 ms max  (0.01%)
  95% of Lock : 0 total, 0 avg, 0 to 0 max
Rows sent     : 1.29k avg, 0 to 64.12k max  (1.07%)
Rows examined : 6.65k avg, 0 to 335.53k max  (0.33%)
Database      : 
Users         : 
        dev@ 172.16.215.80 : 73.43% (2230) of query, 10.45% (5996) of all users
        dev@ 172.16.215.75 : 26.47% (804) of query, 89.07% (51090) of all users
        root@localhost  : 0.10% (3) of query, 0.37% (213) of all users
 
Query abstract:
SET timestamp=N;
 
Query sample:
SET timestamp=1330336845;
 
______________________________________________________________________ 004 ___

解决方案 »

  1.   

    另外一个问题mysql> create index idx_pid_value_xsd on smw_atts2(p_id,value_csd);
    ERROR 1072 (42000): Key column 'value_csd' doesn't exist in table
    mysql> create index idx_pid_value_xsd on smw_atts2(p_id,value_xsd);
    Ctrl-C -- sending "KILL QUERY 37845693" to server ...
    Ctrl-C -- query aborted.
    Query OK, 0 rows affected (6 min 28.39 sec)
    Records: 0  Duplicates: 0  Warnings: 0
     
    mysql> show processlist;这个index 创建时间很长没完成,我就ctrl+c,但是事后发现这个索引已经被加到表里了,这是为何?
      

  2.   

    后面这个问题,ctrl+c,这个事物应该是被rollback了,但是实际上去却commit了,INNODB引擎的,为何会如此?
      

  3.   

    -bash-3.2$ mysqlbinlog mysql-bin.000389|grep 'create index'
    create index idx_pid_value_xsd on smw_atts2(p_id,value_xsd)