2009/11/23 Lee, David <[email protected]>: > I think what Karl is expressing is frustration that basic xpath > expressions appear not to use indexes. > I too am 'in the dark' about that ... and would love some advise. > Why, for example > cts:search( doc("doc.xml")/FOO/BAR , "text") > > uses index ("instant results" ) > > but apparently > doc("doc.xml")/FOO[BAR eq 'text'] > > seems to iterate through the list and not use indexes. (painfully slow > results ... )
Quite often it's down to the processor being able to recognise what you are trying to do and then rewrite it to be faster. In XSLT the usual advice is specify the full path and avoid //foo because it requires walking the entire input tree, but with a database it's better to avoid the full path and use // instead (where the results would be the same) because indexes can be used. I've also heard that using a flowr expression instead of single xpath can help because it simplifies the expression which helps the processor spot what it can optimise. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
