What is the meaning of entries from mysql_stat?

mysql, php, statistics

Solution

Due to PHP DOCS use of `mysql` extension is discouraged. Use `mysqli` instead.

Meanings of fields:

   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.

To reset this values use `#> mysqladmin flush-host` in your mysql server terminal.

Problem

I called the function `mysql_stat()` in PHP, which gave me the following result: - Uptime: 7733455 - Threads: 1 - Questions: 2218231 - Slow queries: 1552 - Opens: 14989 - Flush tables: 1 - Open tables: 6 - Queries per second avg: 0.287 I created the database 6 days ago, but the `uptime` suggests, that it was nearly 90 days ago (or is this the last restart of the server?) What is the threshold for a query beeing `slow query`? Can I somehow check, which queries where slow? How can `open Tables` be 6, if I only have 3 Tables in my database? What is the meaning of the entries `Threads`, `Opens` and `Flush tables`? Is it possible to reset the statistics?

Original source