r46402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46401‎ | r46402 | r46403 >
Date:23:20, 27 January 2009
Author:daniel
Status:deferred
Tags:
Comment:
query tuning
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordConceptStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java
@@ -304,7 +304,7 @@
305305
306306 protected int executeChunkedUpdate(DatabaseAccess.ChunkedQuery query, int factor) throws PersistenceException {
307307 try {
308 - int chunk = updateChunkSize / factor;
 308+ int chunk = factor < 0 ? updateChunkSize * -factor : updateChunkSize / factor;
309309 return database.executeChunkedUpdate(query, chunk, getAgenda());
310310 } catch (SQLException e) {
311311 throw new PersistenceException(e);
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordConceptStoreBuilder.java
@@ -401,12 +401,13 @@
402402
403403 };
404404
405 - return executeChunkedUpdate(query, 1);
 405+ return executeChunkedUpdate(query, -5);
406406 }
407407
408408 protected int buildBiLink() throws PersistenceException {
409409 String sql = "insert ignore into "+relationTable.getSQLName()+" (concept1, concept2, bilink)" +
410 - " select A.anchor, A.target, 1 from "+linkTable.getSQLName()+" as A " +
 410+ " select A.anchor, A.target, 1 from "+linkTable.getSQLName()+" as A " +
 411+ " force index (anchor_target) " + //NOTE: avoid table scan!
411412 " join "+linkTable.getSQLName()+" as B on A.anchor = B.target AND B.anchor = A.target ";
412413 String suffix = " on duplicate key update bilink = bilink + values(bilink)";
413414

Status & tagging log