server数据库【Q209】如何得知一条 SQL 执行的时长?

如何得知一条 SQL 执行的时长?

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 210

Author 回答者: liyihang

1.show profiles; 2.set profiling = 1; 3.show databases; 4.show profiles; ----------+------------+----------------+ | Query_ID | Duration | Query | +----------+------------+----------------+ | 1 | 0.00124300 | show warnings | | 2 | 0.03788000 | show databases | +----------+------------+----------------+

NOTE: The SHOW PROFILE and SHOW PROFILES statements are deprecated; expect them to be removed in a future MySQL release. Use the Performance Schema instead;