Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* 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 ( ...
| 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-est...
- https://stackoverflow.com/questions/21239979/how-to-cle...
- https://dev.mysql.com/doc/refman/5.6/ja/show-profile.html
終了行:
* 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 ( ...
| 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-est...
- https://stackoverflow.com/questions/21239979/how-to-cle...
- https://dev.mysql.com/doc/refman/5.6/ja/show-profile.html
ページ名: