关于查询何子查询的速度问题?

resp 2003-03-24 08:19:15
我在进行一句语句的自查询时发现速度很满,但是如果用了自查询的话速度不应该会满,而应该快的,因为我只要显示记录集的中间部分就可以拉,完全不用查找整个记录,但就这样速度竟然比查询整条记录集还么满,这是为什么?子查询何全部查询语句如下:
自查询:
select top 20 Client.OwnerName,Car.CarFrameNumber,Car.Carnumber,
Client.ClientProperty,Repair.RepairDate,Client.ProvinceID,Client.CountyID,Repair.RepairType,Repair.SelfOpinion
from client
left outer join Sale on client.clientnumber = Sale.clientnumber
left outer join Car on Sale.CarFrameNumber = Car.CarFrameNumber
left outer join Repair on Car.CarFrameNumber = Repair.CarFrameNumber where Client.OwnerName like '% %' and Car.CarFrameNumber like '% %' and Car.CarNumber like '% %' and Client.ClientProperty like '% %' and Client.ProvinceID = '1' and Client.CountyID = '1' and Repair.RepairType like '%三包索赔%' and Repair.SelfOpinion = '1'and Client.ClientNumber not in (select top 0 Client.ClientNumber from client
left outer join Sale on client.clientnumber = Sale.clientnumber
left outer join Car on Sale.CarFrameNumber = Car.CarFrameNumber
left outer join Repair on Car.CarFrameNumber = Repair.CarFrameNumber where Client.OwnerName like '% %' and Car.CarFrameNumber like '% %' and Car.CarNumber like '% %' and Client.ClientProperty like '% %' and Client.ProvinceID = '1' and Client.CountyID = '1' and Repair.RepairType like '%三包索赔%' and Repair.SelfOpinion = '1'order by Client.ClientNumber asc,Repair.SelfOpinion asc)order by Client.ClientNumber asc,Repair.SelfOpinion asc

全部查询如下:
select Client.OwnerName,Car.CarFrameNumber,Car.Carnumber,
Client.ClientProperty,Repair.RepairDate,Client.ProvinceID,Client.CountyID,Repair.RepairType,Repair.SelfOpinion
from client
left outer join Sale on client.clientnumber = Sale.clientnumber
left outer join Car on Sale.CarFrameNumber = Car.CarFrameNumber
left outer join Repair on Car.CarFrameNumber = Repair.CarFrameNumber where Client.OwnerName like '% %' and Car.CarFrameNumber like '% %' and Car.CarNumber like '% %' and Client.ClientProperty like '% %' and Client.ProvinceID = '1' and Client.CountyID = '1' and Repair.RepairType like '%三包索赔%' and Repair.SelfOpinion = '1' order by Client.ClientNumber asc,Repair.SelfOpinion asc


请各位给我解答
...全文
12 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
疑难问题
创建于2007-09-28

2.1w+

社区成员

MS-SQL Server 疑难问题
申请成为版主
帖子事件
创建了帖子
2003-03-24 08:19
社区公告
暂无公告