oracle大数据量插入慢咋整
alter index ind_t_object_id unusable;
下面是测试的过程:
SQL> insert into milktest select * from all_objects; rollback; 72271 rows created. Elapsed: 00:00:02.71 SQL> Rollback complete. SQL> alter index ind_t_object_id unusable; Index altered. Elapsed: 00:00:00.08 SQL> insert into milktest select * from all_objects; 72271 rows created. Elapsed: 00:00:02.26 SQL> rollback; Rollback complete. Elapsed: 00:00:00.31 SQL> insert into milktest select * from all_objects; 72271 rows created. Elapsed: 00:00:01.36 SQL> alter index ind_t_object_id enable; Index altered. Elapsed: 00:00:00.13 SQL> insert into milktest select * from all_objects; 72271 rows created. Elapsed: 00:00:02.91 SQL> rollback; Rollback complete. Elapsed: 00:00:00.32 SQL> insert into milktest select * from all_objects; rollback; 72271 rows created. Elapsed: 00:00:02.24 SQL> Rollback complete. Elapsed: 00:00:00.30 SQL>
最后建议收集一把统计信息。