Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Benchmark

I am trying to use MySQL benchmark to test some queries. But, I am running to an error.

SELECT benchmark (10000, (select title from user));

and in return I get this error;

ERROR 1242 (21000): Subquery returns more than 1 row

Does anyone know how to benchmark a query?

Thanks

like image 377
user239756 Avatar asked Dec 28 '09 19:12

user239756


2 Answers

select title from user

This returns multiple rows, which won't work.

Refer to this link: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_benchmark

The expression you pass must return a scalar result.

You need to change the query such that it returns a single row: ex:

select title from user where user_name = 'some_user'
like image 120
dcp Avatar answered Sep 23 '22 03:09

dcp


you can use the mysqlslap utility to benchmark queries, see: http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html

like image 21
Roland Bouman Avatar answered Sep 19 '22 03:09

Roland Bouman