r54185 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54184‎ | r54185 | r54186 >
Date:20:49, 1 August 2009
Author:daniel
Status:deferred
Tags:
Comment:
partial revert of previous change: do use orphan deletion, but use join instead of subquery
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.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
@@ -289,13 +289,21 @@
290290
291291 ReferenceField f = (ReferenceField)ref.getField(refField);
292292 String field = f.getTargetField();
293 -
 293+
 294+ /*
294295 sql = "DELETE FROM " + table.getSQLName() + " ";
295296 sql += " WHERE NOT EXISTS ( ";
296297 sql += " SELECT * FROM " + ref.getSQLName() + " AS R ";
297298 sql += " WHERE R." + refField + " = "+ table.getSQLName() + "." + field;
298299 sql += " )";
 300+ */
299301
 302+ sql = "DELETE FROM E ";
 303+ sql += " USING " + table.getSQLName() + " AS E ";
 304+ sql += " LEFT JOIN " + ref.getSQLName() + " AS R ";
 305+ sql += " ON R." + refField + " = E." + field;
 306+ sql += " WHERE R." + refField + " IS NULL;";
 307+
300308 long t = System.currentTimeMillis();
301309 int c = executeUpdate("deleteDataFrom", sql);
302310 trace("deleted "+c+" orphan rows from "+table.getName()+" where no reference exists from "+ref.getSQLName()+"."+refField+", took "+(System.currentTimeMillis()-t)/1000+" sec");
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java
@@ -250,7 +250,8 @@
251251 deleteDataFrom(rcId, op, langlinkTable, "resource");
252252 deleteDataFrom(rcId, op, broaderTable, "resource");
253253
254 - deleteDataFrom(rcId, op, conceptTable, "id", aboutTable, "concept", "resource", true);
 254+ deleteDataFrom(rcId, op, aboutTable, "resource");
 255+ deleteOrphansFrom(rcId, op, conceptTable, aboutTable, "concept");
255256
256257 deleteDataFrom(rcId, op, aliasTable, "resource");
257258 deleteDataFrom(rcId, op, sectionTable, "resource");

Status & tagging log