n****e 发帖数: 1403 | | c*****d 发帖数: 6045 | | y*****g 发帖数: 677 | 3 有多个途径实现,看你的精度要求。
1. 用 profiling,
mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT whatstheweatherlike(3);
+-----------------------------------------------------------+
| whatstheweatherlike(3) |
+-----------------------------------------------------------+
| Its 3°C, time is 02:43:25, feels [like] snow is melting |
+-----------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show profiles;
+----------+------------+---------------------------------------------------
----------+
| Query_ID | Duration | Query
|
+----------+------------+---------------------------------------------------
----------+
| 1 | 0.00005100 | SELECT CURTIME() into time
|
| 2 | 0.00014100 | SELECT feeling INTO feels FROM weather WHERE temp
= in_temp |
+----------+------------+---------------------------------------------------
----------+
2 rows in set (0.00 sec)
2. 在你的procedure 里插入两次时间,做一下减法。
3. 使用log_slow_queries, 大致地查查prodecure 运行时间。 |
|