我想show status like 'Qcache_hits';得到Qcache_hits的值,
然后计算 Qcache_hits/Com_select 的值,从而计算query cache的命中率,
Com_select为什么为5呢? 这如何计算!!!

解决方案 »

  1.   

    Com_select查询语句统计数量啊
    然后这个查询语句在query cache里面找到的话,则就算Qcache_hit命中一次
      

  2.   

    找到问题了:The GLOBAL and SESSION options are new in MySQL 5.0.2. With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MySQL. With SESSION, it displays the status values for the current connection. If no modifier is present, the default is SESSION. LOCAL is a synonym for SESSION.根据上边所说用show status like "Com_select";显示的是一次会话的值!
    所以应该用 show global status like "Com_select";
      

  3.   


    MySQL 中很多变量有有global 和 session 两级。
      

  4.   

    是的,如果那变量值有session和global的,查询时没加session或global,则默认显示当前session的