---------------------------------------------------------------
--搭建测试环境:
--查看索引是否存在于当前用户
select * from dba_indexes where owner='system' and index_name='IDX_TEST_INDEX';
DROP TABLE TEST_INDEX;
CREATE TABLE TEST_INDEX
(
USERID NUMBER,
USERNAME VARCHAR2(32),
CREATEDATE DATE
);
DROP TABLE TEST_INDEX_DATA;
CREATE TABLE TEST_INDEX_DATA AS SELECT * FROM TEST_INDEX;
BEGIN
FOR I IN 1 .. 2000000 LOOP
INSERT INTO TEST_INDEX_DATA VALUES (I, '测试索引_' || I, SYSDATE);
END LOOP;
COMMIT;
END;
SELECT COUNT(1) FROM TEST_INDEX_DATA;
SELECT COUNT(1) FROM TEST_INDEX;
----------------------------------------------------------
--没有索引的时候,直接插入数据
TRUNCATE TABLE TEST_INDEX;--0.078
INSERT INTO TEST_INDEX SELECT * FROM TES