On Freitag, 28. Dezember 2007, Lau, William (NIH/CIT) [E] wrote:
> We have a set of semantic queries in a template. That template is used
> in some pages. However, by looking at the database process list, it
> seems that those set of queries are processed whenever a page is
> requested, even when the template is not used by the requested page
> (e.g. special pages). 

Do I understand this correctly? The delivery of special pages that are 
completely unrelated to said template triggers the ask-queries contained 
therein? This would be very strange behaviour indeed (I cannot currently 
imagine how or why this should happen in MediaWiki)!

> All the SQL queries are generated by the 
> getQueryResult function. Since those queries are very computational
> intensive, this "bug" slows down the entire site. If we take the inline
> queries out of the template or change $smwgQEnabled to false, the site
> becomes fast again. Has anyone experienced the same issue?

In general, if queries on some site are too slow, it is useful to configure 
SMW to support faster querying (with less features, of course). Basic 
settings one can try to speed up querying are:

include_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php');
$smwgQSubcategoryDepth = 0;
$smwgQSubpropertyDepth = 0;
$smwgQEqualitySupport = SMW_EQ_NONE;
$smwgQDefaultNamespaces = NULL;
enableSemantics("semedia-wiki.localhost");

Those settings will speed up basically all queries, disabling all support for 
property and category hierarchies, equality (redirects), and namespace 
restrictions (i.e. queries consider pages in all namespaces, including, e.g., 
User:). You can experiment which of those, if any, affects your query 
performance positively.

If you have problems with too complex user-generated queries, then the 
parameters $smwgQMaxSize and $smwgQMaxDepth are an option to restrict this.

In general, it should be emphasised that queries should be used in a targetted 
way. Ontoworld.org had the infamous template {{ask}} for some time, which 
included queries for almost anything, which would just not appear if no 
results would be obtained. Most wikis should rather have single query 
templates for special purposes instead of trying to have one for all.

Anyway, for further optimisation, we need some pointer to your site, or at 
least some statistical information concerning its size 
(Special:SemanticStatistics) and the query structure. Did you mention the SMW 
version you use? Some of the above assume SMW1.0-RC3, and none will work 
prior to SMW1.0-RC1.

Markus


-- 
Markus Krötzsch
Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe
phone +49 (0)721 608 7362        fax +49 (0)721 608 5998
[EMAIL PROTECTED]        www  http://korrekt.org

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to