I am working in mysql. I have a stored procedure which takes 1 min to run. I have to run this procedure 10 times with different parameters. How can I run the 10 instances of procedure simultaneously with different parameters? My procedure is such that no locking will happen between any 2 instances.
If you are using Linux then one solution is to create shell scripts and run them as cron jobs at a particular time. Here is an example shell script. This script is named as sql1.sh and it will write the current date to out1.txt
#!\bin\bash
date > out1.txt
so i have made sql1.sh till sql5.sh and the output written into out1.txt till out5.txt
Here is the crontab file to execute the shell scripts at 19:37.
37 19 * * * /yourDirectory/sql1.sh
37 19 * * * /yourDirectory/sql2.sh
37 19 * * * /yourDirectory/sql3.sh
37 19 * * * /yourDirectory/sql4.sh
37 19 * * * /yourDirectory/sql5.sh
Here is the output from out1.txt till out5.txt
Mon Feb 4 19:37:01 UTC 2019 - out1.txt
Mon Feb 4 19:37:01 UTC 2019 - out2.txt
Mon Feb 4 19:37:01 UTC 2019 - out3.txt
Mon Feb 4 19:37:01 UTC 2019 - out4.txt
Mon Feb 4 19:37:01 UTC 2019 - out5.txt
so instead of date command use mysql with suitable options to run your sql query. This may not be efficient but will get the job done.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.