--2~3 ろ. ? 覃覈襴 一危郁 殊 る 螳 蠍 .. set statistics io on set nocount on declare @dt char(8) set @dt = '20080115' select * from test where dt = @dt --企 'test'. 蟆 1, 朱Μ 所鍵 15589, 覓朱Μ 所鍵 32, 覩碁Μ 所鍵 4
if object_id('test') is not null drop table test; go with temp1(num) as ( select 1 num union all select num + 1 from temp1 where num + 1 <= 5000 ), temp2(num) as ( select 1 num union all select num + 1 from temp2 where num + 1 <= 600 ) select identity(int,1,1) seq , convert(char(8), getdate() + b.num, 112) dt , left(newid(), 12) dumy1-- 一危磯ゼ 豈j鍵 , newid() dumy2-- 一危磯ゼ 豈j鍵 into test from temp1 a, temp2 b option (maxrecursion 0); create clustered index cix_seq on test(seq); --企 'test'. 蟆 1, 朱Μ 所鍵 19738, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 906 create index nix_dt on test(dt); --企 'test'. 蟆 1, 朱Μ 所鍵 20443, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 3953
--狩企ろ磯 碁煙る 蟲譟一 れ′語り 覦螻, 覯蟆 襴讌 --企ろ磯 碁煙るゼ 襦 . --2~3 ろ. ? 覃覈襴 一危郁 殊 る 螳 蠍 .. set statistics io on set nocount on declare @dt char(8) , @min_seq int , @max_seq int set @dt = '20080115' select @min_seq = min(seq) , @max_seq = max(seq) from test where dt = @dt select * from test where seq between @min_seq and @max_seq --企 'test'. 蟆 2, 朱Μ 所鍵 6, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0 --企 'test'. 蟆 1, 朱Μ 所鍵 38, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0 --select 15589/(6+38) --354