其中B表中的ID集合,是A表ID的子集。
现在要执行如下语句:
select count(*) from A where id in (select id from B)
发现效率很低,怎么改比较好。各位兄弟给点建议,多谢!
...全文
214420打赏收藏
两个大表的关联查询问题-如何提高效率
现在有两个表,都有10万条记录 A表 -------------------- id name age sex B表 ----------------------- id address phone birth 其中B表中的ID集合,是A表ID的子集。 现在要执行如下语句: select count(*) from A where id in (select id from B) 发现效率很低,怎么改比较好。各位兄弟给点建议,多谢!