Last modified: 2008-04-28 09:53:03 UTC
I enable profiling, and noticed in the log 10 sets of SQL: INSERT /* SMW::getPropertyTable 127.0.0.1 */ INTO smw_res (title) SELECT `smw_subprops`.subject_title FROM `smw_subprops`,smw_new WHERE `smw_subprops`.object_title=smw_new.title in the log for every query of a property, even when the property has no subproperties. If you look at SMW_SQLStore.php's getPropertyTable(), the $i<$smwgQSubpropertyDepth loop has two if ($db->affectedRows() == 0) { // no change, exit loop continue; but PHP's "continue" *doesn't* exit the loop, the doc says "skip the rest of the current loop iteration and continue execution at the condition evaluation". I don't understand the second INSERT IGNORE, but I think somewhere the code can truly exit the loop using PHP's "break". Getting rid of 9 INSERT WHERE's might help performance. (It might also be worth restructuring the code to avoid creating one or both of the temporary tables until needed.) I think there might be a similar glitch in getCategoryTable(). It has different code structure, it does the two INSERTs in a row.
Oops, indeed! The same issue occurred in the category-materialisation above. Fixed in SVN now.