【问题标题】:What is the meaning of entries from mysql_stat?mysql_stat 中的条目是什么意思?
【发布时间】:2012-08-15 15:43:27
【问题描述】:

我在 PHP 中调用了函数mysql_stat(),结果如下:

  • 正常运行时间:7733455
  • 线程数:1
  • 问题:2218231
  • 慢查询:1552
  • 开张:14989
  • 刷新表:1
  • 打开表:6
  • 平均每秒查询次数:0.287

我在 6 天前创建了数据库,但 uptime 表明它是近 90 天前(或者这是服务器的最后一次重启?)

slow query 的查询阈值是多少?

我可以检查一下,哪些查询慢?

如果我的数据库中只有 3 个表,open Tables 怎么可能是 6?

ThreadsOpensFlush tables 这些条目的含义是什么?

是否可以重置统计信息?

【问题讨论】:

    标签: php mysql statistics


    【解决方案1】:

    由于 PHP DOCS 不鼓励使用 mysql 扩展名。请改用mysqli

    字段含义:

       o   Uptime
    
           The number of seconds the MySQL server has been running.
    
       o   Threads
    
           The number of active threads (clients).
    
       o   Questions
    
           The number of questions (queries) from clients since the server was
           started.
    
       o   Slow queries
    
           The number of queries that have taken more than long_query_time
           seconds. (MySQL DOSC "The Slow Query Log" section).
    
       o   Opens
    
           The number of tables the server has opened.
    
       o   Flush tables
    
           The number of flush-*, refresh, and reload commands the server has
           executed.
    
       o   Open tables
    
           The number of tables that currently are open.
    
       o   Memory in use
    
           The amount of memory allocated directly by mysqld. This value is
           displayed only when MySQL has been compiled with safemalloc, which
           is available only before MySQL 5.5.6.
    
       o   Maximum memory used
    
           The maximum amount of memory allocated directly by mysqld. This
           value is displayed only when MySQL has been compiled with
           safemalloc, which is available only before MySQL 5.5.6.
    

    要重置此值,请在您的 mysql 服务器终端中使用 #> mysqladmin flush-host

    【讨论】:

    • 但是“服务器打开的表数”是多少?
    【解决方案2】:

    如果您的网站托管在共享主机中,则该信息可能来自多个数据库,而不仅仅是您的! :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-29
      • 2021-04-16
      • 1970-01-01
      • 1970-01-01
      • 2015-01-06
      • 2020-04-01
      • 1970-01-01
      • 2011-06-07
      相关资源
      最近更新 更多