Contents

1 Filtered Index
2 Example
3 谿瑚襭


1 Filtered Index #

磯 碁煙る 譟郁唄襯 企 朱 碁煙燕. れ螻 螳 レ .

  • レ焔 貎朱Μ 焔 覦 螻 讌
  • 譴企 碁煙 讌 蟯襴 觜
  • 譴企 碁煙 レ 觜

2 Example #

use tempdb
go

--drop table test
create table test(gender nchar(1));

with temp(num)
as
(
        select 1 num
        union all
        select num + 1 from temp
        where num + 1 <= 10
)
insert test(gender) 
select N'' -- 1000蟇
from temp a, temp b, temp c
union all
select N'' -- 10蟇
from temp;

create nonclustered index filtered_nix
on test(gender)
where gender = N'';

--full scan 襴
select * from test where gender = N'' --れ襦 Full Scan.

--index seek 襴
select * from test where gender = N'' --れ襦 Index Seek.

3 谿瑚襭 #