TOP的效率問題

select top 500 *from (select top 100 percent * from [dbo].[stg_address] a wherea.state_province_cd='NJ' order by a.created_dt) as sub

 

select top 500 *from [dbo].[stg_address] a where a.state_province_cd='NJ' order by a.created_dt

 

First query is better than second because TOP is useless if you have where clause onnon-index column

 

http://www.cnblogs.com/oneword/archive/2011/01/27/1946076.html

發佈了31 篇原創文章 · 獲贊 6 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章