由於我啓動了從一個表插入7M行到另外兩個表的過程,現在我想知道是否有更快的方法來做到這一點。預計該過程將在一個小時內完成,即24小時處理。更快插入Oracle散列簇表
這是怎麼一回事呢:
從該表
RAW (word VARCHAR2(4000), doc VARCHAR2(4000), count NUMBER);
的數據應該找到其他兩個羣集表T1一個新的家和T2
CREATE CLUSTER C1 (word VARCHAR2(4000)) SIZE 200 HASHKEYS 10000000;
CREATE CLUSTER C2 (doc VARCHAR2(4000)) SIZE 200 HASHKEYS 10000000;
T1 (word VARCHAR2(4000), doc VARCHAR2(4000), count NUMBER) CLUSTER C1(word);
T2 (doc VARCHAR2(4000), word VARCHAR2(4000), count NUMBER) CLUSTER C2(doc);
通過Java插入帶有手動這樣的提交
stmtT1 = conn.prepareStatement("insert into T1 values(?,?,?)");
stmtT2 = conn.prepareStatement("insert into T2 values(?,?,?)");
rs = stmt.executeQuery("select word, doc, count from RAW");
conn.setAutoCommit(false);
while (rs.next()) {
word = rs.getString(1);
doc = rs.getString(2);
count = rs.getInt(3);
if (commitCount++==10000) { conn.commit(); commitCount=0; }
stmtT1.setString(1, word);
stmtT1.setString(2, doc);
stmtT1.setInt(3, count);
stmtT2.setString(1, doc);
stmtT2.setString(2, word);
stmtT2.setInt(3,count);
stmtT1.execute();
stmtT2.execute();
}
conn.commit();
有什麼想法?
嘿感謝您的建議。我使用Java來監視數據傳輸過程(剩下多少行),普通的INSERT AS SELECT不會告訴我。我總是以相同的方式訪問表,如select * from T1 where word ='foo';對於那個哈希表我覺得最好。 – chris 2008-12-15 02:36:39