Join query or subquery

2019-04-08 23:30发布

Are there rules of thumb for developers when to use join instead of subquery or are they the same.

8条回答
相关推荐>>
2楼-- · 2019-04-09 00:04

In SQL Server a correlated subquery usually performs worse than a join or, often even better for performance, a join to a derived table. I almost never write a subquery for anything that will have to be performed multiple times. This is because correlated subqueries often basically turn your query into a cursor and run one row at a time. In databases it is usually better to do things in a set-based fashion

查看更多
对你真心纯属浪费
3楼-- · 2019-04-09 00:05

Theoretically every subquery can be changed to a join query.

查看更多
登录 后发表回答