在空表上创建索引后插入数据还是在oracle上插入数据后创建唯一索引?

Insertion of data after creating index on empty table or creating unique index after inserting data on oracle?(在空表上创建索引后插入数据还是在oracle上插入数据后创建唯一索引?)

本文介绍了在空表上创建索引后插入数据还是在oracle上插入数据后创建唯一索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个选项更好更快?在空表上创建索引后插入数据或在插入数据后创建唯一索引.我有大约 10M 行要插入.哪个选项会更好,以便我可以减少停机时间.

Which option is better and faster? Insertion of data after creating index on empty table or creating unique index after inserting data. I have around 10M rows to insert. Which option would be better so that I could have least downtime.

推荐答案

先插入数据,然后创建索引.

Insert your data first, then create your index.

每次执行 UPDATE、INSERT 或 DELETE 操作时,表上的任何索引也必须更新.因此,如果您先创建索引,然后插入 10M 行,则索引也必须更新 10M 次(除非您正在执行批量操作).

Every time you do an UPDATE, INSERT or DELETE operation, any indexes on the table have to be updated as well. So if you create the index first, and then insert 10M rows, the index will have to be updated 10M times as well (unless you're doing bulk operations).

这篇关于在空表上创建索引后插入数据还是在oracle上插入数据后创建唯一索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在空表上创建索引后插入数据还是在oracle上插入数据后创建唯一索引?

基础教程推荐