From: Wolfgang M. <wol...@gm...> - 2007-09-22 09:35:15
|
> I executed the following query using the latest svn trunk (today): > > //((#exist:optimize#) {file[@type="ima"]}) > > The query reponse found 0 items, even though there are several. Mmmmh, this should not happen. The general comparison should finally fall back to a brute force scan if it cannot use any indexes. > The trace shows that finds a qname, but it cannot use it since the > collection /db/pefx/appsDescriptor has not defined an index. The only > index defined for the moment is located at > exist:/db/system/config/db/apps/users Yes, to use the index on the qname, it is necessary that all collections in the input document set define an index. The optimizer has to make this decision at compile time and it only sees the information in the collection configuration. It has no further information about the real distribution of nodes in the collection. My next plan for the optimizer is to store some better statistics which could help in selecting the correct strategy. In the meantime, you should try to restrict your query to collections which do define an appropriate index: collection("/db/apps/users")//((#exist:optimize#) {file[@type="ima"]}) Wolfgang |