有两个表A(a1,a2,a3,a4),B(b1,b2,b3,b4),做两个表连接查询
select a1,a2,b1,b2
from A,B
where a.a1=b.b1 and a.a2=b.b2 and a.a3=b.b3 and a.a4=b.b4
创建了索引 create index b_idx on b(b1,b2,b3,b4)
可是查询速度还是很慢,有什么方法优化吗?
...全文
355打赏收藏
请问:多个字段连接的语句如何优化?
有两个表A(a1,a2,a3,a4),B(b1,b2,b3,b4),做两个表连接查询 select a1,a2,b1,b2 from A,B where a.a1=b.b1 and a.a2=b.b2 and a.a3=b.b3 and a.a4=b.b4 创建了索引 create index b_idx on b(b1,b2,b3,b4) 可是查询速度还是很慢,有什么方法优化吗?