如何有意创建长时间运行的MySQL查询 [英] How to Intentionally Create a Long-Running MySQL Query

查看:78
本文介绍了如何有意创建长时间运行的MySQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个奇怪的问题,但是我想知道是否可以创建一个MySQL查询,而数据库中却没有数百万行会消耗资源并长时间运行.我的最终目标是在资源争用的情况下测试我的应用程序,并确保我处理故障的方法(特别是服务器超时)是正确的.

I know this is an odd question to ask, but I'd like to find out if there is a MySQL query I can create without already having millions of rows in my database that will consume resources and run for a long time. My ultimate goal is to test my application in cases of resource contention and make sure that my methods for handling failure (specifically server timeout) are correct.

如果还有另一种方法可以在不创建和执行高资源查询的情况下对此进行测试,那么我也很高兴听到此消息.

If there another way I can test this without creating and executing a high-resource query, I'd appreciate hearing that as well.

推荐答案

我认为您可以为此使用benchmark(),尽管这不是它的范围.

I assume you could use benchmark() for this, although that isn't the scope of it.

select benchmark(9999999999, md5('when will it end?'));

这篇关于如何有意创建长时间运行的MySQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆