JOIN查询与多个查询 [英] JOIN queries vs multiple queries

查看:93
本文介绍了JOIN查询与多个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JOIN查询比几个查询更快吗? (您运行主查询,然后根据主查询的结果运行许多其他SELECT)

Are JOIN queries faster than several queries? (You run your main query, and then you run many other SELECTs based on the results from your main query)

我问是因为加入他们会使A LOT设计我的应用程序

I'm asking because JOINing them would complicate A LOT the design of my application

如果他们更快,任何人都可以粗略估计多少?如果它是1.5x我不在乎,但如果是10x我想我做。

If they are faster, can anyone approximate very roughly by how much? If it's 1.5x I don't care, but if it's 10x I guess I do.

推荐答案

这是太模糊给你一个与你的具体情况相关的答案。这取决于很多事情。 Jeff Atwood(这个网站的创始人)其实写道这。在大多数情况下,如果你有正确的索引,并且你正确地做了你的JOIN,它通常会比几个更快的做一次旅行。

This is way too vague to give you an answer relevant to your specific case. It depends on a lot of things. Jeff Atwood (founder of this site) actually wrote about this. For the most part, though, if you have the right indexes and you properly do your JOINs it is usually going to be faster to do 1 trip than several.

这篇关于JOIN查询与多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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