SELECT *
FROM TableA a
JOIN TableB b ON a.Id = b.Id
WHERE a.Column1 = 1 AND a.Column2 <= 2 AND a.Column3 >= 2
其中 TableA 上 Id 有索引,TableB上id是主键,TableA上Column1/Column2/Column3有索引
------最佳解决方案--------------------------------------------------------
create index x3 on TableB(id);
分别创建如下两个索引,并测试
create index x on TableA(Column1,Column2);
create index x2 on TableA(Column1,Column3);
------其他解决方案--------------------------------------------------------
建立复合索引Id、Column1、Column2、Column3