Kimball在他的ETL Toolkit一書中,一直強(qiáng)調(diào):對(duì)于有外鍵約束的表,為了提高load的速度,可以先將外鍵約束disable,加載完成后再enable(當(dāng)然另外一個(gè)原因是進(jìn)入數(shù)據(jù)倉(cāng)庫(kù)的數(shù)據(jù)都是規(guī)范的,甚至可以考慮不使用外鍵約束,即違反約束的數(shù)據(jù)在Transformation部分就應(yīng)該解決掉,當(dāng)然這是設(shè)計(jì)問題了)。ps:另外兩個(gè)提高load速度的方法分別為使用sql loader和insert、update分離。當(dāng)時(shí)還不是明白這個(gè)過程怎么具體實(shí)現(xiàn),今天看《oracle concept》看到下面話終于明白了一些:
Flexibility for Data Loads and Identification of Integrity Violations
You can disable integrity constraints temporarily so that large amounts of data can be loaded without the overhead of constraint checking. When the data load is complete,you can easily enable the integrity constraints, and you can automatically report any new rows that violate integrity constraints to a separate exceptions table.
看來(lái)oracle這點(diǎn)上做的比較完善,還可以將違反完整性約束的數(shù)據(jù)自動(dòng)記錄到一個(gè)exception表中。