56,677
社区成员
发帖
与我相关
我的任务
分享
#the first time
mysql> select now(); select sql_no_cache count(*) from customer where locale ='ad2dadaasdadas1dasdpasd1';select now();
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:46:03 |
+---------------------+
1 row in set (0.00 sec)
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (40.68 sec)
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:46:57 |
+---------------------+
1 row in set (0.00 sec)
#######the second time
mysql> select now(); select sql_no_cache count(*) from customer where locale ='ad2dadaasdadas1dasdpasd1';select now();
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:48:01 |
+---------------------+
1 row in set (0.00 sec)
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (43.70 sec)
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:48:55 |
+---------------------+
1 row in set (0.03 sec)
#the third time
mysql> select now(); select sql_no_cache count(*) from customer where locale ='ad2dadaasdadas1dasdpasd1';select now();
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:49:25 |
+---------------------+
1 row in set (0.00 sec)
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (46.41 sec)
+---------------------+
| now() |
+---------------------+
| 2011-10-09 19:50:25 |
+---------------------+
1 row in set (0.03 sec)
mysql> select now(); select sql_no_cache count(*) from customer where locale ='ad2dadaasdadas1dasdpasd1';select now();
+---------------------+
| now() |
+---------------------+
| 2011-10-09 21:43:12 |
+---------------------+
1 row in set (0.01 sec)
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (40.24 sec)
+---------------------+
| now() |
+---------------------+
| 2011-10-09 21:44:03 |
+---------------------+
1 row in set (0.01 sec)
mysql> show profiles;
+----------+-------------+-------------------------------------------------------------------------------------+
| Query_ID | Duration | Query |
+----------+-------------+-------------------------------------------------------------------------------------+
| 1 | 0.07349300 | select now() |
| 2 | 51.17799800 | select sql_no_cache count(*) from customer where locale ='ad2dadaasdadas1dasdpasd1' |
| 3 | 0.00044100 | select now() |
+----------+-------------+-------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
mysql> show profile for query 2;
+--------------------+-----------+
| Status | Duration |
+--------------------+-----------+
| starting | 0.012984 |
| Opening tables | 0.000535 |
| System lock | 0.000015 |
| Table lock | 0.000010 |
| init | 0.015226 |
| optimizing | 0.000165 |
| statistics | 0.000362 |
| preparing | 0.000107 |
| executing | 0.000007 |
| Sending data | 51.115373 |
| end | 0.000014 |
| query end | 0.000003 |
| freeing items | 0.000111 |
| logging slow query | 0.000003 |
| logging slow query | 0.033072 |
| cleaning up | 0.000011 |
+--------------------+-----------+
16 rows in set (0.00 sec)
mysql> select now(), sleep(3), now();
+---------------------+----------+---------------------+
| now() | sleep(3) | now() |
+---------------------+----------+---------------------+
| 2011-10-10 11:43:27 | 0 | 2011-10-10 11:43:27 |
+---------------------+----------+---------------------+
1 row in set (3.02 sec)
mysql> select sysdate(), sleep(3), sysdate();
+---------------------+----------+---------------------+
| sysdate() | sleep(3) | sysdate() |
+---------------------+----------+---------------------+
| 2011-10-10 11:43:36 | 0 | 2011-10-10 11:43:39 |
+---------------------+----------+---------------------+
1 row in set (3.00 sec)
set @dt=now(); CALL lp_bulk_insert(1000000); select timestampdiff(second,@dt,now());