<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-mailStijl17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="NL" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Vishnu,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Your FLWOR expression won’t return distinct names, since you are applying the function to each individual name. You should write:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">distinct-values(</span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">    for $a in //*</span></p><p class="MsoNormal" style="text-indent:35.4pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">    return $a</span></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">)</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Or better:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">distinct-values(collection()//*/local-name())</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">But this still might not perform well, or still max out on list or tree caches. This approach is creating a complete list of all element names first, and starts applying distinct-values only thereafter. You might consider taking multiple steps, like per doc first, and then clustering per 100 files, and only then all clusters. You could also just take 100 random samples, and use that. That doesn’t guarantee a 100% complete list, but it remains performant even if your database grows 10 or 100 fold.</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Kind regards,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Geert</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Van:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:general-bounces@developer.marklogic.com">general-bounces@developer.marklogic.com</a> [mailto:<a href="mailto:general-bounces@developer.marklogic.com">general-bounces@developer.marklogic.com</a>] <b>Namens </b>VISH RAJPUT<br>
<b>Verzonden:</b> maandag 26 maart 2012 8:29<br><b>Aan:</b> <a href="mailto:general@developer.marklogic.com">general@developer.marklogic.com</a><br><b>Onderwerp:</b> [MarkLogic Dev General] Fwd: [1.0-ml] XDMP-EXPNTREECACHEFULL</span></p>
</div></div><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-bottom:12.0pt">The size of the all files is 90 MB approx.</p><div><p class="MsoNormal">---------- Forwarded message ----------<br>From: <b>VISH RAJPUT</b> &lt;<a href="mailto:svishnu.singh4@gmail.com">svishnu.singh4@gmail.com</a>&gt;<br>
Date: Mon, Mar 26, 2012 at 11:56 AM<br>Subject: [1.0-ml] XDMP-EXPNTREECACHEFULL<br>To: <a href="mailto:general@developer.marklogic.com">general@developer.marklogic.com</a><br><br><br>Hi,</p><div><p class="MsoNormal"> </p>
</div><div><p class="MsoNormal">I have 2000 files in Marklogic database within a single forest and i want to find out the unique element name from this database for the whole 2000 files. For this i wrote the below query:-</p>
</div><div><p class="MsoNormal"> </p></div><div><div><p class="MsoNormal">for $a in //*</p></div><div><p class="MsoNormal">return distinct-values($a/local-name()))</p></div></div><div><p class="MsoNormal"> </p></div><div>
<p class="MsoNormal">but by this i got an error &quot;<b><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">[1.0-ml] XDMP-EXPNTREECACHEFULL&quot; </span></b> what should i do?</p></div><div><p class="MsoNormal">
 </p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Regards,</p></div><div><p class="MsoNormal">Vishnu Singh</p></div></div><p class="MsoNormal"> </p></div></div></body></html>