[xquery-talk] search mechanism

Michael Kay mhk at mhk.me.uk
Fri Apr 7 09:45:57 PDT 2006


> Well, and eXist seems to be one of them! ;-) I am amazed of 
> how much faster
> the "predicate-way" is - at least in the case of eXist!
> 

Unfortunately I suspect it will take a while till optimizers in different
products converge to the point where one can give generic coding advice that
applies across products - as the response to my point about "//" illustrates
(it's long been conventional wisdom in XSLT to tell people to avoid "//",
but in fact there are cases in Saxon where it outperforms /a/b/c/d, at least
if used repeatedly: if you only use it once then you incur the costs of
building an index without any of the benefits; but of course in a database
product, those costs are amortized over many queries. So there are a lot of
variables!)

As far as predicates are concerned, Saxon does its best to break up a
"where" clause into components that relate to the individual "for" clauses,
and thus effectively translates the where clause into a set of predicates. I
know there are products that do the opposite! To me it's much more natural
to write the conditions as predicates close to the path expressions that
they qualify. It's only SQL users who find it natural to bundle all the
conditions together in one place.

Michael Kay
http://www.saxonica.com/




More information about the talk mailing list