Hi David, I would start by creating a range index of type string using the codepoint collation (http://marklogic.com/collation/codepoint) on your "item" element.
You might also try using xdmp:query-trace on this before and after creating the range index. You should be able to tell if it helps and see less fragments selected after you create the range index. -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Lee, David Sent: Tuesday, November 10, 2009 3:15 PM To: [email protected] Subject: [MarkLogic Dev General] Optimize exact match searches on attributes Suppose I have an XML document with about 50,000 of these small elements <item name="Peritoneum" parent="A01.047.025" code="A01.047.025.600"/> And an Xquery that does a LOT of this kind of search let $item = $root/tree/item[ @code = $code ] or let $item = $root/tree/item[ @parent = $code ] These are exact string matches, no fancy terming or wildcards or anything. Any suggestions on the basic area to look for optimizing this kind of access ? Either using xquery or a setting on the server ? Thanks for any suggestions. So far I've only been able to find things tailored for full text searching (1 letter, 2 letter, word searches etc). I would think direct attribute=value searches could be tagged for efficient indexing. Maybe they are already ? But its starting to slow down when I do about 20 of these in an xquery. One thought I had was to preprocess the data into more of a tree structure instead of the flat structure it is now ... <item > <item> <item> </item> </item> then I can use ancestor axis to search up the tree instead of a flat search ... But if these were already indexed it "should" be a near instant access as a flat structure (???) ---------------------------------------- David A. Lee Senior Principal Software Engineer Epocrates, Inc. [email protected] 812-482-5224 _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
