1、创建test_index实验表。
create table test_index(id number,name varchar2(30));
2、在表中插入200万条简单数据。
begin
for i in 1..2000000
loop
insert into test_index values(i,'aa'||i);
end loop;
commit;
end;
简单查看改表中的前20条数据
select * from test_index where rownum <=20;
3、创建索引,对比查询速度。
3.1、以name字段,创建索引。
create index index_test_name on test_index(name);
3.2、查询id=954321的数据。
select * from test_index where id = 954321;
所需时间为:0.045s