---------------------------------------------------------------
--搭建测试环境:
--查看索引是否存在于当前用户
select*fromdba_indexeswhereowner=systemandindex_name=IDX_TEST_INDEX;
DROPTABLETEST_INDEX;
CREATETABLETEST_INDEX
(
USERIDNUMBER,
USERNAMEVARCHAR2(32),
CREATEDATEDATE
);
DROPTABLETEST_INDEX_DATA;
CREATETABLETEST_INDEX_DATAASSELECT*FROMTEST_INDEX;
BEGIN
FORIIN1..2000000LOOP
INSERTINTOTEST_INDEX_DATAVALUES(I,测试索引_||I,SYSDATE);
ENDLOOP;
COMMIT;
END;
SELECTCOUNT(1)FROMTEST_INDEX_DATA;
SELECTCOUNT(1)FROMTEST_INDEX;
----------------------------------------------------------
--没有索引的时候,直接插入数据
TRUNCATETABLETEST_INDEX;--0.078
INSERTINTOTEST_INDEXSELECT*FROMTES