How can I run a query multiple times in phpmyadmin

2019-02-27 14:15发布

I want a way to be able to benchmark a query like 1,000,000 times. What's the easiest way to do this? Currently I've searched for a way to issue a query multiple times but nothing pops up.

I've also come across the benchmark() command that can be run in mysql command line, but it seems to have some limitations and I can't seem to get it to work.

3条回答
在下西门庆
2楼-- · 2019-02-27 14:22

From the MySQL Documentation:

CREATE PROCEDURE doiterate(p1 INT)
BEGIN
  label1: LOOP
    SET p1 = p1 + 1;
    (Your real query would go here)
    IF p1 < 10 THEN ITERATE label1; END IF;
    LEAVE label1;
  END LOOP label1;
  SET @x = p1;
END;

You could paste this code in phpmyadmin's SQL tab, then run it.

查看更多
姐就是有狂的资本
3楼-- · 2019-02-27 14:40

This isn't really the job of phpMyAdmin, a GUI for MySQL beginners.

Put the query in a script, in a loop that runs 1,000,000 times.

Though that's not a very good benchmark of anything. If you're trying to simulate real demand, you need to have some concurrent activity, not just 1,000,000 queries issued and returned one at a time.

查看更多
欢心
4楼-- · 2019-02-27 14:43

i would suggest doing loop test from script level as this would give a better time of the demand.

SELECT benchmark (1000000, (select user from members limit 1));
查看更多
登录 后发表回答