Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
biiiiiigmonster authored Dec 21, 2020
1 parent 4e38f7a commit 5cfc85e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ composer require biiiiiigmonster/hasin
`Laravel ORM`的关联关系非常强大,基于关联关系的查询`has`也给我们提供了诸多灵活的调用方式,然而某些情形下,`has`使用了where exists语法实现

#### `select * from A where exists (select * from B where A.id=B.id)`
> exists是对外表做loop循环,每次loop循环再对内表(子查询)进行查询,那么因为对内表的查询使用的索引(内表效率高,故可用大表),而外表有多大都需要遍历,不可避免(尽量用小表),故内表大的使用exists,可加快效率
> exists是对外表做loop循环,每次loop循环再对内表(子查询)进行查询,那么因为对内表的查询使用的索引(内表效率高,故可用大表),而外表有多大都需要遍历,不可避免(尽量用小表),故内表大的使用exists,可加快效率
但是当**A表**数据量较大的时候,就会出现性能问题,那么这时候用**in**语法将会极大的提高性能

Expand Down

0 comments on commit 5cfc85e

Please sign in to comment.