Let’s say that you want to measure something in your database, and for that you need several operations to happen in parallel. If you have a capable programming language at your disposal (Perl, Python, Ruby, PHP, or Java would fit the bill) you can code a test that sends several transactions in parallel.
But if all you have is the shell and the mysql client, things can be trickier. Today I needed such a parallel result, and I only had mysql and bash to accomplish the task.
In the shell, it’s easy to run a loop:
for N in $(seq 1 10)
mysql -h host1 -e "insert into sometable values($N)"
But this does run queries sequentially, and each session will
open and close before the next one starts. Therefore there is no
concurrency at all.
Then I thought that the method for parallel execution in the shell is to run things in the background, and then collect the …