SQL Advanced Subquery Optimization
Language
2023-06-12 00:27:30
views: null
in 与 exists
indexed
inner join
It is best to use when there is an index , next in
, exists
worst
no index
- The small table drives the large table, because
join
the method requires distinct
, no index distinct
consumes a lot of performance
- So exists has the best performance, followed by in, and join has the worst performance.
- Large tables drive small tables
- The performance of in and exists should be close, both are worse, and exists is slightly better, exceeding 5%.
- But it's much faster
inner join
because of usingjoin buffer
Origin blog.csdn.net/youhebuke225/article/details/130941297