MySQL Benchmark

前端 未结 3 800
盖世英雄少女心
盖世英雄少女心 2021-01-02 05:35

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));
<
3条回答
  •  庸人自扰
    2021-01-02 06:01

    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));
    

提交回复
热议问题