[MarkLogic Dev General] Improving Lookup Performance

Michael Blakeley michael.blakeley at marklogic.com
Wed Oct 29 09:04:38 PST 2008


The third query is a fairly common case: you'll probably want to use a 
range-index and cts:element-values().


The other two queries look to me like they should be able to make full 
use of the indexes. From here I can't tell why that isn't working for 
you, and in any case armchair optimization rarely does much good.

So I recommend that you start with the "Query Performance and Tuning" 
pdf (http://developer.marklogic.com/pubs/). Read about 
xdmp:query-trace() and xdmp:query-meters(), and experiment with cq's 
"profile" button. Once you know where your queries are spending time, 
and which indexes are being used, you will be in a better position to 
optimize them or to ask more questions.

-- Mike

Steve wrote:
> Folks,
> I've got a MarkLogic instance running with approximately 100,000
> documents in it (this needs to scale to approximately 2.5 million),
> and I'm doing some basic lookups etc.
> I've been executing queries such as those shown below, however the
> results are taking a long time to come back. I've got indexes against
> the elements and attributes that I'm trying to lookup, however I'm
> looking for other ways to improve performance of queries. Anybody got
> any suggestions??
> example queries
> fn:collection()[/doc/item/classification/@value = "class1"]
> fn:colleciton()[//classification/@value = "class1"]
> fn:distinct-values(fn:collection()[/doc/item/name])
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

More information about the General mailing list