Preface The sleep system function in MySQL has few practical application scenarios and is generally used for experimental testing. Yesterday, when testing, I accidentally discovered a special phenomenon of the sleep function. If the sleep function is used in a query statement, the sleep time is related to the records returned. As shown in the following test: mysql> create table test(id int); Query OK, 0 rows affected (0.03 sec) mysql> select *, sleep(6) from test; Empty set (0.00 sec) mysql> insert into test values(1); Query OK, 1 row affected (0.00 sec) mysql> select * ,sleep(6) from test; +------+----------+ | id | sleep(6) | +------+----------+ | 1 | 0 | +------+----------+ 1 row in set (6.00 sec) mysql> insert into test value(2); Query OK, 1 row affected (0.01 sec) mysql> select * ,sleep(6) from test; +------+----------+ | id | sleep(6) | +------+----------+ | 1 | 0 | | 2 | 0 | +------+----------+ 2 rows in set (12.00 sec) Test summary: If, select *, sleep(n) from table, if the table record is empty, there will be no sleep. If the table record is one, then the sleep time is 1*n. If the table record is 2, then the sleep time is: 2*n ............ and so on. In the official documentation, 12.24 Miscellaneous Functions does not mention this phenomenon, and I really don't know how to explain this situation. I speculated on several scenarios, but all of them were denied. Let me record this issue for now. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Tutorial on using portainer to connect to remote docker
>>: js and jquery to achieve tab status bar switching effect
Table of contents Object parameters using destruc...
JS implements a hover drop-down menu. This is a s...
=================================================...
binlog is a binary log file that records all DML ...
Table of contents 1. Import files 2. HTML page 3....
This article records the installation graphic tut...
/******************** * Virtual File System VFS *...
Introduction to Swap Swap (i.e. swap partition) i...
This article example shares the specific code of ...
When using CSS pseudo-elements to control element...
Omit the protocol of the resource file It is reco...
Virtualization 1. Environment Centos7.3 Disable s...
Table of contents Preface Axios installation and ...
Hexo binds a custom domain name to GitHub under W...
Table of contents 1. Use the "rpm -ivh insta...