如何在 phpmyadmin 中多次运行查询?

发布于 2024-11-27 19:54:58 字数 149 浏览 1 评论 0原文

我想要一种能够对查询进行 1,000,000 次基准测试的方法。做到这一点最简单的方法是什么?目前,我已经多次搜索发出查询的方法,但没有弹出任何内容。

我还遇到过可以在 mysql 命令行中运行的 benchmark() 命令,但它似乎有一些限制,我似乎无法让它工作。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

稚然 2024-12-04 19:54:58

这实际上并不是 phpMyAdmin 的工作,phpMyAdmin 是一个针对 MySQL 初学者的 GUI。

将查询放入脚本中,循环运行 1,000,000 次。

尽管这并不是一个很好的基准。如果您尝试模拟真实需求,则需要一些并发活动,而不仅仅是一次发出并返回 1,000,000 个查询。

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.

芸娘子的小脾气 2024-12-04 19:54:58

我建议从脚本级别进行循环测试,因为这可以更好地满足需求。

SELECT benchmark (1000000, (select user from members limit 1));

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));
半步萧音过轻尘 2024-12-04 19:54:58

MySQL 文档

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;

您可以将此代码粘贴到phpmyadmin 的 SQL 选项卡,然后运行它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文