SELECT * FROM TableA WHERE ColA IN ('B105', 'C101') --ColA Non-Clustered Index螳 焔 . --Clustered Index 焔讌 . -- Query れ ろ Index Seek襯 り 螳.
SELECT ColA FROM TableA WHERE ColA IN ('B105', 'C101')
--ColA Non-Clustered Index螳 焔 螻, Index Seek襯 螳. SELECT ColA, ColB --ColB螳 Index襷 曙伎 覈襯碁. 一危 伎襯 曙伎朱 觜襦 ColB襯 螳語 . FROM TableA WHERE ColA IN ('B105', 'C101') SELECT ColA, ColB, ColC --ColC襦 襷谿螳讌. FROM TableA WHERE ColA IN ('B105', 'C101') SELECT ColA FROM TableA WHERE ColA IN ('B105', 'C101') AND ColB = '2005' --SELECT 覈讌 讌襷 企 Row螳 譟郁唄 襷讌 螳る 一危 伎襯 曙伎 . SELECT ColA FROM TableA WHERE ColA IN ('B105', 'C101') ORDER BY ColC -- 伎 ColC螳 蠍 覓語 一危 伎襯 曙伎 .
use pubs go exec sp_helpindex titles /* index_name index_description index_keys ----------------- ------------------------------------------------- ---------- titleind nonclustered located on PRIMARY title UPKCL_titleidind clustered, unique, primary key located on PRIMARY title_id */ dbcc show_statistics (titles, titleind) /* All density Average Length Columns ------------------- -------------------- --------------------- 5.5555556E-2 33.0 title 5.5555556E-2 39.0 title, title_id --> title_id 企ろ磯 碁煙り 焔 . */
use tempdb; set statistics io on create table index_test ( seq bigint ); insert index_test select top 10000 row_number() over(order by(select 1)) seq from master..spt_values a cross join master..spt_values b; create index idx1 on index_test(seq); create unique index idx2 on index_test(seq); --non unique index select * from index_test with (index=idx1) where seq <= 255 --朱Μ 所鍵 2, 譟郁唄 seq <= 256 企 朱Μ 所鍵 3 --unique index select * from index_test with (index=idx2) where seq <= 367 --朱Μ 所鍵 2, 譟郁唄 seq <= 368 企 朱Μ 所鍵 3
/* 企覲 碁煙れ 糾螳 襷讌襷朱 一危碁 讌 谿剰鍵 伎 (朱) 2003.10. (MS) 2004.8. */ SELECT USER_NAME( OBJECTPROPERTY( i.id, 'OwnerID' ) ) AS Owner ,OBJECT_NAME( i.id ) AS [Table] , i.name AS [Index] ,CASE INDEXPROPERTY( i.id , i.name , 'IsClustered') WHEN 1 THEN 'Y' ELSE '' END AS IsClustered ,CASE INDEXPROPERTY( i.id , i.name , 'IsUnique' ) WHEN 1 THEN 'Y' ELSE '' END AS IsUnique ,STATS_DATE( i.id , i.indid ) AS LastUpdatedDate ,dPages * 8. /1024 AS MB FROM sysindexes AS i WHERE OBJECTPROPERTY( i.id, 'IsMSShipped' ) = 0 AND 1 NOT IN ( INDEXPROPERTY( i.id , i.name , 'IsStatistics' ) , INDEXPROPERTY( i.id , i.name , 'IsAutoStatistics' ) , INDEXPROPERTY( i.id , i.name , 'IsHypothetical' ) ) AND i.indid BETWEEN 1 And 250 -- AND dPages > 100 -- 蠍 企 覓伎 AND (STATS_DATE( i.id , i.indid ) < getdate() - 15 OR STATS_DATE( i.id , i.indid ) IS NULL) --15 伎蟾讌 一危 蟆 ORDER BY Owner, [Table], [Index] --豢豌: dbguide.net