#author("2018-12-07T00:27:12+09:00","default:ryuichi","ryuichi")
* SQLの実行時間を調べる の編集 [#l625b7c8]

 mysql> SET profiling = 1;
 mysql> SHOW PROFILES;
 
 +----------+------------+-------------------------------------+
 | Query_ID | Duration   | Query                               |
 +----------+------------+-------------------------------------+
 |        1 | 0.24838463 | CREATE TABLE t1 ( n int )           |
 |        2 | 0.07959324 | INSERT INTO t1 ( n ) VALUES ( 100 ) |
 |        3 | 0.04948013 | SELECT * FROM t1                    |
 +----------+------------+-------------------------------------+
 3 rows in set (0.03 sec)

- mysqlコマンドでDBにアクセスして、上のクエリーを実行する。
- DBからログアウトするとプロファイルは消える。


** プロファイルを消す [#h641d9b2]

 SET @@profiling = 0;
 SET @@profiling_history_size = 0;
 SET @@profiling_history_size = 100; 
 SET @@profiling = 1;

または

 TRUNCATE TABLE information_schema.PROFILING;

または、ログアウトする

** 参考 [#jeedfba0]

https://stackoverflow.com/questions/12925140/how-to-estimate-sql-query-timing

- https://stackoverflow.com/questions/12925140/how-to-estimate-sql-query-timing
- https://stackoverflow.com/questions/21239979/how-to-clear-mysql-query-profiles
- https://dev.mysql.com/doc/refman/5.6/ja/show-profile.html

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS