如何使结果集中的每一行返回多次?
我正在编写一个使用 Mysql 的应用程序,目前我的表中没有太多数据。我想测试我的应用程序如何处理大量数据。为了做到这一点,我需要结果集中的每一行重复多次。
我知道我可以运行查询并将其与相同的查询联合起来,并与相同的查询联合起来。是否有其他方法可以让我更轻松地选择发生多少次重复?
I'm writing an application that uses Mysql and for now my tables don't have many data in it. I want to test how my application handles a larger amount of data. In order to do that I need each row in the resultset to repeat itself several times.
I know that I can run the query and UNION it with the same query and UNION that with the same query. Is there a different way that makes it easier for me to choose how many duplications will occur?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您有一个要插入的表
以生成虚拟数据。 http://www. generatedata.com 这将生成数据以及插入脚本。
然后创建一个海量数据集
Make sure you have a table to insert into
To generate dummy data. http://www.generatedata.com This will generate the data as well as the insert scripts.
Then Just create a massive dataset
你可以对其本身进行交叉连接,这会产生 2^n 个结果,但这都是肮脏的黑客行为
You could do a cross join on itself, which would yield 2^n results, but it's all going to be dirty hacks