(急)两段sql查询语句性能的比较和sql执行计划中的“表假脱机”?
1、sql执行计划中的“表假脱机”是什么意思?执行机制是怎么样的?
2、两段sql查询语句执行后的目的是一样的,两条语句都没有错,
问题是 这两条语句的性能差别在哪?原因是什么?
我在这守着,看看有没有人来。
2、两段sql查询语句执行后的目的是一样的,两条语句都没有错,
问题是 这两条语句的性能差别在哪?原因是什么?
--语句1:
select top 1 A.UserId,A.Phone,B.CodeId,Cmd,Addr,key1,key2,RContent,B.FeeMode from dbo.[V_AddFeePhoneUser] A WITH(NOLOCK),
(
select A.AreaId,A.FeeMode,A.OperatorsType,A.CodeId,Cmd,Addr,key1,key2,RContent from dbo.V_AreaToFeeCode_FeeCodeInfo A WITH(NOLOCK),
(
select AreaId,OperatorsType from dbo.UserInfo WITH(NOLOCK)
where AreaId>0 and Phone!='' and IMSI!='' and MonthSumFee<800 and addflag=0 and AvailFlag=1 group by AreaId,OperatorsType having COUNT(AreaId)>10
) C ,
dbo.V_GetUsableMaxCode B WITH(NOLOCK)
where A.FeeMode=11 and A.AreaId=C.AreaId and A.OperatorsType=C.OperatorsType and A.CodeId=B.CodeID
) B
where A.AreaId=B.AreaId and A.OperatorsType=B.OperatorsType
and
0.00005 >= CAST(CHECKSUM(NEWID(), UserId) & 0x7fffffff AS float)/ CAST (0x7fffffff AS int)
order by UserId
--和下面语句对比
--语句2:
select top 1 A.UserId,A.Phone,B.CodeId,Cmd,Addr,key1,key2,RContent,B.FeeMode from dbo.[V_AddFeePhoneUser] A WITH(NOLOCK),
(
select A.AreaId,A.FeeMode,A.OperatorsType,A.CodeId,Cmd,Addr,key1,key2,RContent from dbo.V_AreaToFeeCode_FeeCodeInfo A WITH(NOLOCK),
(
select AreaId,OperatorsType from dbo.UserInfo WITH(NOLOCK)
where AreaId>0 and Phone!='' and IMSI!='' and MonthSumFee<800 and addflag=0 and AvailFlag=1 group by AreaId,OperatorsType having COUNT(AreaId)>10
) C ,
dbo.V_GetUsableMaxCode B WITH(NOLOCK)
where A.FeeMode=11 and A.AreaId=C.AreaId and A.OperatorsType=C.OperatorsType and A.CodeId=B.CodeID
) B
where A.AreaId=B.AreaId and A.OperatorsType=B.OperatorsType
and
0.00005 >= CAST(CHECKSUM(NEWID(), UserId) & 0x7fffffff AS float)/ CAST (0x7fffffff AS int)
--两个的性能差别在哪?原因是什么?
我在这守着,看看有没有人来。
...全文
相关推荐
db2查看sql执行计划
db2查看sql执行计划
oracle11g执行计划管理-(讲解如何固定sql的执行计划)
摘要:本文描述了11g的新特性之一:执行计划管理,介绍了引入该新特性的原因,以及该新特性的相关特点、工作原理等。最后通过引入一个测试案例来介绍如何使用该新特性。 分析了如何固定优化过的执行计划,避免被sql优化器CBO覆盖
查询优化:sql2000中的连接两个表的查询语句的执行路径对性能的影响比较
NULL 博文链接:https://dolphin-ygj.iteye.com/blog/517388
通过分析SQL语句的执行计划优化SQL(总结)
NULL 博文链接:https://huangtut.iteye.com/blog/285494
看懂 sql server 执行计划
看不懂sql server 执行计划,该文档可以给你帮助!


