饿虎岗资源网 Design By www.oxmxm.com
看代码:
复制代码 代码如下:
set statistics io on
set statistics time on
go
set statistics profile on
go
use pubs
select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')
and (cast(zip as int) > 90000)
select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (cast(zip as int) > 90000)
and (state like 'CA' or state like 'UT')
select * from authors
where (cast(zip as int) > 90000)
and (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')
目的:想验证where语句的各个条件的查询顺序
环境:SQLServer 2005Express版本
步骤:显示查询计划
结果:无一例外,都被统一成了这样的代码
复制代码 代码如下:
|--Clustered Index Scan(OBJECT:([pubs].[dbo].[authors].[UPKCL_auidind]), WHERE:(CONVERT(int,[pubs].[dbo].[authors].[zip],0)>(90000) AND ([pubs].[dbo].[authors].[au_fname] like 'S%' OR [pubs].[dbo].[authors].[au_fname] like 'a%') AND ([pubs].[dbo].[authors].[state] like 'CA' OR [pubs].[dbo].[authors].[state] like 'UT')))
结论:貌似在2005之前的版本中,where子句的顺序是从前往后的。但是又貌似在2005的版本中进行了优化,所有的顺序都被统一成了以过滤能力进行排序的语句。
复制代码 代码如下:
set statistics io on
set statistics time on
go
set statistics profile on
go
use pubs
select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')
and (cast(zip as int) > 90000)
select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (cast(zip as int) > 90000)
and (state like 'CA' or state like 'UT')
select * from authors
where (cast(zip as int) > 90000)
and (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')
目的:想验证where语句的各个条件的查询顺序
环境:SQLServer 2005Express版本
步骤:显示查询计划
结果:无一例外,都被统一成了这样的代码
复制代码 代码如下:
|--Clustered Index Scan(OBJECT:([pubs].[dbo].[authors].[UPKCL_auidind]), WHERE:(CONVERT(int,[pubs].[dbo].[authors].[zip],0)>(90000) AND ([pubs].[dbo].[authors].[au_fname] like 'S%' OR [pubs].[dbo].[authors].[au_fname] like 'a%') AND ([pubs].[dbo].[authors].[state] like 'CA' OR [pubs].[dbo].[authors].[state] like 'UT')))
结论:貌似在2005之前的版本中,where子句的顺序是从前往后的。但是又貌似在2005的版本中进行了优化,所有的顺序都被统一成了以过滤能力进行排序的语句。
饿虎岗资源网 Design By www.oxmxm.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
饿虎岗资源网 Design By www.oxmxm.com
暂无评论...
更新日志
2024年05月03日
2024年05月03日
- BlackWings Audio《女神异闻录 夜幕魅影-OST1》[320K/MP3][113.76MB]
- 海来阿木《西楼情歌》开盘母带[低速原抓WAV+CUE]
- 陈百强.2003-完全陈百强5CD【华纳】【WAV+CUE】
- 群星.2012-顾听生辉·乐坛大宗师经典半世纪3CD【环球】【WAV+CUE】
- BlackWings Audio《女神异闻录 夜幕魅影-OST1》[FLAC/分轨][332.91MB]
- 群星《音你而来 第2期》[320K/MP3][72.1MB]
- 群星《音你而来 第2期》[FLAC/分轨][197.58MB]
- 群星-中国新民乐(笛子)-戏竹4CD(DSD)[雨林唱片]WAV+CUE
- JacobCollier《DjesseVol.2》(2019)Hi-Res96kHz_24bit
- 黄品源.2002-漫漫岁月情·珍藏集(引进版)【滚石】【WAV+CUE】
- NorahJones《NotTooLate》(2024)Hi-Res192kHz_24bit
- RIMZEE《FeedTheStreets》(2024)[FLAC]
- 杭天琪.1989-入梦(TP版)【中唱】【WAV+CUE】
- 彭正《十年》[320K/MP3][98.75MB]
- 彭正《十年》[FLAC/分轨][288.77MB]