My knowlege is based on my use of the Xalan implementation. I take it you are selecting a product? If so, the second and third query are wrong. I have corrected it to select the same node:
/products/[EMAIL PROTECTED]'VPU-1001'] //[EMAIL PROTECTED]'VPU-1001'] The first should be quite a bit faster as the collection gets larger, when compared to the second. This would be especially noticable using "//" (descendant axes) patterns near the root of a large document. Here is a link talking about xpath performance with xalan ( http://xml.apache.org/xalan-j/faq.html#faq-8 ). Here is a link with quite a bit of good resources concerning xsl ( http://www.dpawson.co.uk/xsl/xslfaq.html ). Kevin Ross www.bredex.com Dave Hurrell <[EMAIL PROTECTED] To: xindice-users <[email protected]> chiro.com> cc: Subject: Xpath query performance 05/15/2002 02:01 AM Please respond to xindice-users Given a large file of which the following is a small sample: <?xml version="1.0"?> <products xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/vp" src:key="prods"> <product product_id="VPU-1001"> <title>Mamadou Ly Mandinka Drum Master</title> <description>Mandinka drumming</description> </product> <product product_id="VPU-1002"> <title>Tabala Wolof</title> <description>Sufi drumming</description> </product> </products> I believe I can obtain the same document with any one of the following xpath queries: /products/[EMAIL PROTECTED]'VPU-1001'] //*/[EMAIL PROTECTED]'VPU-1001'] /[EMAIL PROTECTED]'VPU-1001'] Do they all the above xpath queries have the same performance? What effect does indexing have? I suspect it would make no difference if the products document was stored as a single document. I think the xquery engine would read the document sequentially searching for the product_id. What happens if I store each product separately into a products database. Indexing allows direct access to the desired product. Does an xindice xpath query use any indexes?
