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") | +---------------------------------------------------------------+ ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.