views:

275

answers:

1

I have a stored procedure which I want to test for speed in a production environment. So I created a new stored procedure which calls this for a 100 times, each time with different parameters. My question is: how can I disable the output that the MySQL command line prints as I am sure that this adds to the total time. So, to recap, from the MySQL command line I would like to perform something like the following:

MySQL> call cbtest;

and I want it to display just the total time taken to run the 100 test sp calls (wrapped in cbtest) rather than show me the results returned for each call.

Thanks in advance, Tim

A: 

How something like on the command line:

$ time echo "call cbtest" | mysql -uuser -ppassword database

Keep in mind that MySQL will probably cache your stored proc, so this might not give you a real good feel of performance.

Seth
Hi Seth! Thanks for the answer...it's giving me three values: real: 0.154s user: 0.018s sys: 0.012s - What does that mean exactly? Are the times for the 100 calls or average? And which of the 3 listed should I take into account? Thanks again, Tim
Real - actual (wall) time taken to run the command. User - time consumed by user processes (probably the mysql command)sys - time consumed by system processes (probably the mysqld server)So, to get the average for your 100 calls, you'll have to divide the "real" time by 100. (Time is a shell built-in command, tells you how long it takes to for a command to complete).
Seth
Thanks Seth! Well answered