由于我启动了从一个表插入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