[Oracle性能模式] 查找某个号码是否在号码段列表中之性能模式
[Oracle性能模式] 查找某个号码是否在号码段列表中之性能模式(2011.04.30)【应用场景】表test每行保存一个号码段(hm0, hm1),不同记录的号码段不会出现交叉。需高效地判断出某个号码是否出现在某个号码段中。-- 建测试表create table test (hm0 number(8) not null, -- 号码起hm1 number(8) not null -- 号码止);-- 插入2万条数据beginfor i in 1..20000 loopinsert into test values(i*100, i*100+10); -- hm0间隔100,每段10个号码,故不会交叉end loop;end;/commit;-- 建索引create index i_test_1 on test(hm0, hm1);【低效模式】-- 查