From: Jeff W. <jef...@tb...> - 2005-07-07 18:48:15
|
Hi, We are building a web-based repository of Tibetan texts. We are using eXist as our read only web index and have been very happy to date with the XQueryServlet and XQueryGenerator API's, in addition to the others supported. Also very happy with the amount of attention paid here on the list serve. We are building our entire web interface using XQuery. Currently our testing is on my MAC OS X 10.3.8, G4 1.67 GHz Processor, 1 GB RAM . Our production server will be a Linux Redhat server, with at least 2 GB RAM with 3 GHz processor, 1 GB RAM. A very common query for us runs quite slow and I am just wondering if anyone has thoughts about how to improve the performance. I dont know if it is an inefficient XQuery statement, or lack of experience on my part with eXist's indexing method. There are roughly 100K XML docs for TBRC-WORKS (in its own collection) and 10K docs for TBRC-PERSONS (in its own collection) and 2K docs for TBRC-TOPICS (in its own collection). Here is a sample query to get all the works by an author. For this I have to query the tbrc-works collection. Author is an element within a single Works document. for $works in collection($tbrc-xutils:db-path-works)/w:work/w:creator[@person=$RID]/ ../w:title[position()=1] let $doc-name := concat($tbrc-xutils:db-path-works,"/M",$works/../@RID,".xml") order by $works ascending return <li><a href="tbrc-work-detail.xq?RID={ $works/../@RID }"> { $works }</a>{ tbrc-xutils:publication-info-summary($doc-name) }</li> Within the FLOWR statement, I call a function tbrc-xutils:publication-info-summary($doc-name) which grabs a few elements from an associated XML document. I also return some basic HTML formating. The problem is that this a very common query and it runs too slow. I also notice that if I just return the XML without formating it seems to be faster. That is return $works rather than return <li><a href="tbrc-work-detail.xq?RID={ $works/../@RID }"> { $works }</a>{ tbrc-xutils:publication-info-summary($doc-name) }</li> A similar query is used to generate all works with a specific subject classification (no function call within the return) for $works in collection($tbrc-xutils:db-path-works)/w:work/w:subject[@class=$RID]/ ../w:title[position()=1] order by $works ascending return <br><a href="tbrc-work-detail.xq?RID={ $works/../@RID }"> { $works }</a></br> This query is just as slow as the first. So the question is, should I be structuring the collections differently? Or specifying indices differently? Or using a different XQuery statement. Was wondering if anyone has any thoughts. Best wishes, Jeff Wallman Tibetan Buddhist Resource Center tbrc.org |