MySQL Benchmark

余生颓废 提交于 2019-11-30 12:20:03
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'

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

From http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_benchmark

Only scalar expressions can be used. Although the expression can be a subquery, it must return a single column and at most a single row. For example, BENCHMARK(10, (SELECT * FROM t)) will fail if the table t has more than one column or more than one row.

Try

SELECT BENCHMARK(10000, (SELECT title FROM user LIMIT 1));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!