Mysql性能优化
Mysql性能优化 Sql 1、profiling 可以使用profiling命令查看sql语句执行的时间。 使用select @@profiling;查看开启状态。 mysql> select @@profiling; +-------------+ | @@profiling | +-------------+ | 0 | +-------------+ 1 row in set (0.36 sec) 默认为0,表示不开启。 使用set命令开启。 mysql> set profiling=1; Query OK, 0 rows affected (0.08 sec) mysql> select @@profiling; +-------------+ | @@profiling | +-------------+ | 1 | +-------------+ 1 row in set (0.16 sec) 使用几条select语句查询后,查看profiles的状态。 mysql> show profiles; +----------+------------+----------------------------------+ | Query_ID | Duration | Query | +----------+------------+-------------------