性能 - 单连接选择与多个简单选择 [英] performance - single join select vs. multiple simple selects

查看:124
本文介绍了性能 - 单连接选择与多个简单选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

只有一种方法可以知道: p>

一般来说,我认为单个连接使数据库可以做很多优化,因为它可以看到需要扫描的所有表,开销减少,它可以



最近,我有大约100个选择语句,我在我的代码中改为JOIN。使用几个索引,我可以从1分钟运行时间到大约0.6秒。


What is better as far as performance goes?

解决方案

There is only one way to know: Time it.

In general, I think a single join enables the database to do a lot of optimizations, as it can see all the tables it needs to scan, overhead is reduced, and it can build up the result set locally.

Recently, I had about 100 select-statements which I changed into a JOIN in my code. With a few indexes, I was able to go from 1 minute running time to about 0.6 seconds.

这篇关于性能 - 单连接选择与多个简单选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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