That isn't very much to go on, or very easy to read: a screenshot that shows 
the top 5-15 lines might be worth looking at.

But since there is only one call taking 93% of shallow time, it almost has to 
be the cts:search() call for the results. So the next step is to query-trace 
that: http://docs.marklogic.com/xdmp:query-trace?q=query-trace

Try something like this:

import module namespace search = "http://marklogic.com/appservices/search";
     at "/MarkLogic/appservices/search/search.xqy";

xdmp:query-trace(true()),
(: bind $query and $options values :)
let $query := ...
let $options := ...
return search:search($query, $options)

The output will be in your ErrorLog.txt, logged at level "Info". The 
interesting lines start with one for 'Analyzing path' (and the line before it 
is useful too). The trace messages end with 'Executing' and 'Selected [...] 
fragments to filter'.

Here's a trivial example with no results. With a complex query it would be 
longer.

2013-03-08 09:18:47.489 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: 
xdmp:value(xs:untypedAtomic("(cts:search(fn:collection(), 
cts:word-query("foo", (&q..."))
2013-03-08 09:18:47.491 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Analyzing path for 
search: fn:collection()
2013-03-08 09:18:47.491 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Step 1 is searchable: 
fn:collection()
2013-03-08 09:18:47.491 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Path is fully searchable.
2013-03-08 09:18:47.491 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Gathering constraints.
2013-03-08 09:18:47.542 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Search query contributed 
1 constraint: cts:word-query("foo", ("lang=en"), 1)
2013-03-08 09:18:47.542 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Executing search.
2013-03-08 09:18:47.551 Info: 8003-cq: 
/MarkLogic/appservices/utils/higher-order.xqy at 1:12: Selected 0 fragments to 
filter

-- Mike

On 8 Mar 2013, at 06:32 , "Singh, Gurbeer" <[email protected]> 
wrote:

> 
> I got this result as higher time consuming
>  
>  
>  
> MarkLogic/appservices/utils/higher-order.xqy:52:8
>       1
>          93
>  
>           4496663
>      93
>  
>           4496712
>           xdmp:value($expr/hof:lambda/@expr)
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Michael Blakeley
> Sent: Thursday, March 07, 2013 3:18 PM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Performance tuning
>  
> Start by constructing a representative slow in cq or qconsole, then profile 
> that query. Looking at the profiler output, where is it spending its time?
>  
> -- Mike
>  
> On 7 Mar 2013, at 11:40 , "Singh, Gurbeer" <[email protected]> 
> wrote:
>  
> >
> > We have a hit in search performance, especially if user belongs to 
> > different region.
> >
> > Here is the scenario
> >
> > We got XML with element <GroupId> & <AccessType > both are INT.
> >
> > <AccessType> will contains 0 or 1 (public/Private)
> >
> > <GroupId> will contain number.
> >
> > Now search logic is , if am a member of GroupId 1, get me all records 
> > ofGroupId 1 AND rest all GroupId with AccessType 0.
> >
> > This means Public/Private of GroupId 1 +  rest all public records.
> >
> > Now if I have a user who belongs to 5-6 different GroupId,my query will 
> > become
> >
> > ((AccessType:1 AND (GroupId:620 OR GroupId:732 OR GroupId:966 OR 
> > GroupId:967 OR GroupId:971 OR GroupId:972 ) ) OR
> >
> >   (AccessType:0))
> >
> > This is working ok with NA region but for EU and other region its very 
> > slow. If GroupId  got increase for any user it’s a timeout
> >
> > We have grammar define in config as
> >
> >   <grammar>
> >     <starter strength="30" apply="grouping" delimiter=")">(</starter>
> >     <starter strength="40" apply="prefix" 
> > element="cts:not-query">NOT</starter>
> >     <starter strength="40" apply="prefix" 
> > element="cts:not-query">EXCEPT</starter>
> >     <joiner strength="10" apply="infix" 
> > element="cts:or-query"tokenize="word">OR</joiner>
> >     <joiner strength="20" apply="infix" 
> > element="cts:and-query"tokenize="word">AND</joiner>
> >     <quotation>"</quotation> (: " :)
> >     <joiner strength="50" apply="constraint">:</joiner>
> >   </grammar>
> >
> > groupId and accestype both are constraint
> >
> >   <constraint name="AccessType">
> >     <range collation="http://marklogic.com/collation/"; type="xs:int" 
> > facet="false">
> >       <facet-option>limit=10</facet-option>
> >       <element ns="http://ms.com/firmwidePolicy"; name="accessType"/>
> >     </range>
> >     <annotation>
> >       
> > <proj:front-pagexmlns:proj="http://marklogic.com/appservices/project";>false</proj:front-page>
> >       
> > <proj:side-barxmlns:proj="http://marklogic.com/appservices/project";>true</proj:side-bar>
> >     </annotation>
> >   </constraint>
> > 
> >   <constraint name="GroupId">
> >     <range type="xs:int" facet="true">
> >       <facet-option>limit=10</facet-option>
> >       <element ns="http://ms.com/firmwidePolicy"; name="groupId"/>
> >     </range>
> >     <annotation>
> >       
> > <proj:front-pagexmlns:proj="http://marklogic.com/appservices/project";>false</proj:front-page>
> >       
> > <proj:side-barxmlns:proj="http://marklogic.com/appservices/project";>true</proj:side-bar>
> >     </annotation>
> >   </constraint>
> >
> > 
> >
> > ~Gurbeer
> >
> >
> >
> >
> > NOTICE: Morgan Stanley is not acting as a municipal advisor and the 
> > opinions or views contained herein are not intended to be, and do not 
> > constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall 
> > Street Reform and Consumer Protection Act. If you have received this 
> > communication in error, please destroy all electronic and paper copies and 
> > notify the sender immediately. Mistransmission is not intended to waive 
> > confidentiality or privilege. Morgan Stanley reserves the right, to the 
> > extent permitted under applicable law, to monitor electronic 
> > communications. This message is subject to terms available at the following 
> > link: http://www.morganstanley.com/disclaimers If you cannot access these 
> > links, please notify us by reply message and we will send the contents to 
> > you. By messaging with Morgan Stanley you consent to the foregoing.
> >
> >
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://developer.marklogic.com/mailman/listinfo/general
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 
> 
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions 
> or views contained herein are not intended to be, and do not constitute, 
> advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform 
> and Consumer Protection Act. If you have received this communication in 
> error, please destroy all electronic and paper copies and notify the sender 
> immediately. Mistransmission is not intended to waive confidentiality or 
> privilege. Morgan Stanley reserves the right, to the extent permitted under 
> applicable law, to monitor electronic communications. This message is subject 
> to terms available at the following link: 
> http://www.morganstanley.com/disclaimers If you cannot access these links, 
> please notify us by reply message and we will send the contents to you. By 
> messaging with Morgan Stanley you consent to the foregoing.
> 
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to