For performance reasons, I would not recommend using the //* notation. Its
expanded version would like the following:
/descendant::node()[attribute::product_id='VPU-1001']
The descendant axis of the root node includes every other node in the tree,
which means you would search every single node for your specified product_id
attribute. Its not very specific and of limited use for large documents.

I'm assuming you mean this for the third query:
/[EMAIL PROTECTED]'VPU-1001']]
This query is not very useful in your document. It will return the entire
products element, including all of its children. This is of course your
entire document, so I don't think this is what you want to do.

I hope this helps.

John


-----Original Message-----
From: Dave Hurrell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 15, 2002 3:02 AM
To: xindice-users
Subject: Xpath query performance


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?

Reply via email to