Insertion of data after creating index on empty table or creating unique index after inserting data on 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上插入数据后创建唯一索引?


- SQL 临时表问题 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01