BENCHMARK(count,expression)

Description: Executes expression the number of times specified by count.

BENCHMARK() always returns 0. However, if this command is run from the mysql monitor client, mysql displays the elapsed time in seconds.

This is a way of measuring the time taken to execute a command. However, because elapsed time, not CPU time, is measured by mysql, the load on the server from other clients should be taken into account to get a meaningful result.

Example (in mysql monitor):

mysql> SELECT BENCHMARK(1000000000,"SELECT * FROM products ORDER BY price");
+---------------------------------------------------------------+
| BENCHMARK(1000000000,"SELECT * FROM products ORDER BY price") |
+---------------------------------------------------------------+
|                                                             0 |
+---------------------------------------------------------------+
1 row in set (28.42 sec)

indicates that the SELECT executes, on average, in 28.42/1000000000=2.842×10-8 seconds.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.67.27