溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

批量導入某大張表數據的時候的最佳實踐

發布時間:2020-08-11 18:45:50 來源:ITPUB博客 閱讀:175 作者:lusklusklusk 欄目:關系型數據庫
批量導入某大張表數據的時候的最佳實踐:
1、把表上所有的索引都設置為unusable: alter index <index name> unusable;
2、做批量導入
3、rebuild索引:alter index <index name> 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
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女