Hi,

I am trying to write a xquery-expression that does a test on an attribute (id="1"). Unfortunately the query execution time for this query is really bad (>30 seconds).

Is there any way to find out why this query takes so long? 30 seconds for a test on one single attribute is just way to high for our use-case. I read that MonetDB automatically creates indices on all attribute - is there a way to test, if there was an index created for that attribute and if that index was used for query execution?


The query (in File q3.xp) is supposed to return the molecule with id "1"
declare namespace xq="http://www.xml-cml.org/schema";
<smiles> {
  for $i in collection("tu")
  where $i/xq:molecule/@id = "1"
    return
      <smile>{$i}</smile>
} </smiles>


The query is executed like this:
# mclient -t -lx -G q3.xp
...
Trans      55.684 msec
Shred      18.818 msec
Query   29335.766 msec
Print       0.258 msec


The database contains 1.000.000 XML-documents in a single collection, is updatable and is about 2601 MiB. A document looks similar to this one:
<?xml version="1.0" encoding="UTF-8"?>
<molecule id=“1“ xmlns="http://www.xml-cml.org/schema">
    <bondArray atomRef1="..."  order="..."/>
    <atomArray atomID="..." elementType="..." x3="..."/>
    <identifier convention="iupac:smile" value="..."/>
    <identifier convention="iupac:inchi" value="..."/>
</molecule>

We are using:
"MonetDB/XQuery 0.36.5, based on the pathfinder compiler and MonetDB 4.36.1"


Thank you very much for any help!

Patrick