批量导入某大张表数据的时候的最佳实践
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,批量导入某大张表数据的时候的最佳实践:1、把表上所有的索引都设置为unusable: alter index unusable;2、做批量导入3、rebuild索引:alter index reb
千家信息网最后更新 2026年10月31日批量导入某大张表数据的时候的最佳实践批量导入某大张表数据的时候的最佳实践:
1、把表上所有的索引都设置为unusable: alter index unusable;
2、做批量导入
3、rebuild索引:alter index rebuild parallel nologging;
演示如下
SQL> create table emp as select * from employees;
Table created.
SQL> create index idx_emp_job on emp(job_id);
Index created.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
BYTES
----------
65536
SQL> alter index idx_emp_job unusable;
Index altered.
SQL> insert into emp select * from emp;
107 rows created.
SQL> /
214 rows created.
SQL> /
428 rows created.
SQL> /
856 rows created.
SQL> /
1712 rows created.
SQL> /
3424 rows created.
SQL> /
6848 rows created.
SQL> /
13696 rows created.
SQL> /
27392 rows created.
SQL> /
54784 rows created.
SQL>
SQL>
SQL>
SQL> /
109568 rows created.
SQL> commit;
Commit complete.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
no rows selected
SQL> select status from user_objects where object_name='IDX_EMP_JOB';
STATUS
-------
VALID
SQL> alter index IDX_EMP_JOB rebuild parallel 4 nologging;
Index altered.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
BYTES
----------
5373952
1、把表上所有的索引都设置为unusable: alter index
2、做批量导入
3、rebuild索引:alter index
演示如下
SQL> create table emp as select * from employees;
Table created.
SQL> create index idx_emp_job on emp(job_id);
Index created.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
BYTES
----------
65536
SQL> alter index idx_emp_job unusable;
Index altered.
SQL> insert into emp select * from emp;
107 rows created.
SQL> /
214 rows created.
SQL> /
428 rows created.
SQL> /
856 rows created.
SQL> /
1712 rows created.
SQL> /
3424 rows created.
SQL> /
6848 rows created.
SQL> /
13696 rows created.
SQL> /
27392 rows created.
SQL> /
54784 rows created.
SQL>
SQL>
SQL>
SQL> /
109568 rows created.
SQL> commit;
Commit complete.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
no rows selected
SQL> select status from user_objects where object_name='IDX_EMP_JOB';
STATUS
-------
VALID
SQL> alter index IDX_EMP_JOB rebuild parallel 4 nologging;
Index altered.
SQL> select bytes from user_segments where segment_name='IDX_EMP_JOB';
BYTES
----------
5373952
索引
数据
时候
大张
实践
演示
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
科技互联网政务服务
工业互联网科技新基建
善班互联网科技有限公司
互联网金融科技平台
赫美联合互联网科技
互联网科技的未来发展
无锡溥仪互联网科技有限公司
中盈科技互联网信息有限公司
随着互联网科技发展
武汉健翔互联网络科技有限公司
荆州市昕露互联网络科技有限公司
中国航天科技大学国际工业互联网
互联网科技和信息
互联网科技研发水平
本届互联网博览会上的黑科技
互联网科技收购价值
北京军民互联网科技公司
杭州融税互联网科技有限公司
陕西彩京云互联网科技有限公司
华人运通互联网科技公司
盈实互联网科技
智能科技公司是互联网公司吗
猫创互联网科技
广西拼得多互联网科技有限公司
河南住房之家互联网科技
如何创新互联网科技
互联网科技公司营业执照怎么办理
互联网金融运营模式中的金融科技
上海旺乐尼互联网科技有限公司
小牛互联网科技有限公司地址