Bug #81137 auto add sleep interval between source file's queries

Submitted: 19 Apr 2016 11:37
Reporter: Leon Zhang Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:mysql 5.5.31 OS:Any
Assigned to: CPU Architecture:Any

[19 Apr 2016 11:37] Leon Zhang
Description:
There is a scene that when we source a sql file, we want to execute each query separately and sleep several seconds between two queries.
We usually add "select sleep(N);" between queries. It will take much time if we frequency be asked to do so.

How to repeat:
mysql> select 1;select 1;
--------------
select 1
--------------

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
##default no sleep here
--------------
select 1
--------------

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

Suggested fix:
cat > test.sql
select 1;
select 1;
ctrl+D

mysql> \i 1
mysql>interval 1
mysql> select 1;select 1;
mysql> source test.sql

--------------
select 1
--------------

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

sleepping before execute next query
--------------
select 1
--------------

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

sleepping before execute next query

I have writen a simple patch for this issue, find it in attachment.
[19 Apr 2016 11:40] Leon Zhang
This patch is base mysql-5.5.31 community

Attachment: mysql_interval.5.5.31.patch (text/x-patch), 2.46 KiB.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.