SHOW QUERIES

  1. SHOW QUERIES

SHOW QUERIES returns information about all the queries running now. It outputs a table with the following structure:

  • id: query id which can be used in KILL to terminate the query
  • query: query statement or a part of it
  • protocol: connection protocol, the possible values are sphinx , mysql , http , ssl , compressed and replication or combination (e.g. http,ssl or compressed,mysql )
  • host: ip:port of the client
  • SQL

SQL

  1. mysql> SHOW QUERIES;

Response

  1. +------+--------------+----------+-----------------+
  2. | id | query | protocol | host |
  3. +--------------------------+-----------------------+
  4. | 6 | select | http | 127.0.0.1:41128 |
  5. | 4 | show queries | mysql | 127.0.0.1:56672 |
  6. +------+--------------+----------+-----------------+
  7. 2 rows in set (0.61 sec)

See also SHOW THREADS if you want to know what’s going on from the threads angle of view.

KILL

  1. KILL <query id>

KILL terminates execution of a query by its id which you can find in SHOW QUERIES.

  • SQL

SQL

  1. mysql> KILL 4;
  2. Query OK, 1 row affected (0.00 sec)

SHOW WARNINGS

SHOW WARNINGS statement can be used to retrieve the warning produced by the latest query. The error message will be returned along with the query itself:

  1. mysql> SELECT * FROM test1 WHERE MATCH('@@title hello') \G
  2. ERROR 1064 (42000): index test1: syntax error, unexpected TOK_FIELDLIMIT
  3. near '@title hello'
  4. mysql> SELECT * FROM test1 WHERE MATCH('@title -hello') \G
  5. ERROR 1064 (42000): index test1: query is non-computable (single NOT operator)
  6. mysql> SELECT * FROM test1 WHERE MATCH('"test doc"/3') \G
  7. *************************** 1\. row ***************************
  8. id: 4
  9. weight: 2500
  10. group_id: 2
  11. date_added: 1231721236
  12. 1 row in set, 1 warning (0.00 sec)
  13. mysql> SHOW WARNINGS \G
  14. *************************** 1\. row ***************************
  15. Level: warning
  16. Code: 1000
  17. Message: quorum threshold too high (words=2, thresh=3); replacing quorum operator
  18. with AND operator
  19. 1 row in set (0.00 sec)