<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:04:59 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-4111] seems like explain() loads documents, prevents doing just index preheat</title>
                <link>https://jira.mongodb.org/browse/SERVER-4111</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;the line we usually use for index preheat seems to load up all docs.&lt;br/&gt;
In this example docs are created like:&lt;/p&gt;

&lt;p&gt;&amp;gt; var inc = &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;&lt;br/&gt;
&amp;gt; var str = inc&lt;br/&gt;
&amp;gt; while (str.length &amp;lt; 2000) str += inc;&lt;br/&gt;
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;br/&gt;
&amp;gt; for (var i = 0; i &amp;lt; 200000; ++i) db.large.save(&lt;/p&gt;
{i: i, s: str}
&lt;p&gt;);&lt;br/&gt;
&amp;gt; db.large.ensureIndex(&lt;/p&gt;
{i: 1}
&lt;p&gt;);&lt;br/&gt;
&amp;gt; db.large.find(&lt;/p&gt;
{i:1}
&lt;p&gt;).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor i_1&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 1,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 1,&lt;br/&gt;
	&quot;n&quot; : 1,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;indexBounds&quot; : &lt;/p&gt;
{
		&quot;i&quot; : [
			[
				1,
				1
			]
		]
	}
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// create index so that we can find docs without table scan&lt;br/&gt;
&amp;gt; db.large.find({s: {$ne: &quot;a&quot;} }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BasicCursor&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 200000,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 200000,&lt;br/&gt;
	&quot;n&quot; : 200000,&lt;br/&gt;
	&quot;millis&quot; : 106,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;/p&gt;

&lt;p&gt;	}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Then if you load up all docs, resident is 445m&lt;br/&gt;
 1054 antoine   20   0 1215m 445m 428m S    0  2.8   0:05.23 mongod&lt;/p&gt;

&lt;p&gt;Now restart mongod, and query docs 1 by 1 with explain:&lt;br/&gt;
&amp;gt; for (var i = 0; i &amp;lt; 200000; i += 1) db.large.find(&lt;/p&gt;
{i: i}
&lt;p&gt;).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor i_1&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 1,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 1,&lt;br/&gt;
	&quot;n&quot; : 1,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;indexBounds&quot; : &lt;/p&gt;
{
		&quot;i&quot; : [
			[
				199999,
				199999
			]
		]
	}
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Resident is low, only index was touched:&lt;br/&gt;
 2146 antoine   20   0 1145m  36m  25m S    0  0.2   0:44.24 mongod&lt;/p&gt;

&lt;p&gt;Now use the trick we usually do for index preheat:&lt;br/&gt;
&amp;gt; db.large.find({i: {$ne: -1} }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor i_1 multi&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 200000,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 200000,&lt;br/&gt;
	&quot;n&quot; : 200000,&lt;br/&gt;
	&quot;millis&quot; : 2980,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;br/&gt;
		&quot;i&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				&lt;/p&gt;
{
					&quot;$minElement&quot; : 1
				}
&lt;p&gt;,&lt;br/&gt;
				-1&lt;br/&gt;
			],&lt;br/&gt;
			[&lt;br/&gt;
				-1,&lt;/p&gt;
				{
					&quot;$maxElement&quot; : 1
				}
&lt;p&gt;			]&lt;br/&gt;
		]&lt;br/&gt;
	}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Result is that all docs / pages are loaded in resident:&lt;br/&gt;
 2146 antoine   20   0 1145m 432m 421m S    0  2.7   0:45.05 mongod&lt;/p&gt;

&lt;p&gt;It seems as thought the &quot;BTree Multi&quot; touches actual docs, at least in the explain.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="23884">SERVER-4111</key>
            <summary>seems like explain() loads documents, prevents doing just index preheat</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="antoine">Antoine Girbal</assignee>
                                    <reporter username="antoine">Antoine Girbal</reporter>
                        <labels>
                    </labels>
                <created>Thu, 20 Oct 2011 23:40:31 +0000</created>
                <updated>Fri, 30 Mar 2012 14:27:00 +0000</updated>
                            <resolved>Fri, 21 Oct 2011 06:04:17 +0000</resolved>
                                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="61953" author="eliot" created="Fri, 21 Oct 2011 23:51:26 +0000"  >&lt;p&gt;Already is pre-heat case &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2023&quot; title=&quot;touch command to pre-heat a collection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2023&quot;&gt;&lt;del&gt;SERVER-2023&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="61915" author="antoine" created="Fri, 21 Oct 2011 21:30:47 +0000"  >&lt;p&gt;Ok this works well:&lt;br/&gt;
&amp;gt; db.large.find({}, &lt;/p&gt;
{i: 1, _id: 0}
&lt;p&gt;).hint(&lt;/p&gt;
{i: 1}
&lt;p&gt;).count()&lt;br/&gt;
200000&lt;/p&gt;

&lt;p&gt;changing this ticket to add a preheat method, seems to come up pretty often.&lt;br/&gt;
will create ticket for $ne case.&lt;/p&gt;</comment>
                            <comment id="61771" author="eliot" created="Fri, 21 Oct 2011 06:40:43 +0000"  >&lt;p&gt;$ne could be special cased for multi-key, but i would make a clean case for that.&lt;/p&gt;

&lt;p&gt;Easiest way to preheat an index is&lt;/p&gt;

&lt;p&gt;db.foo.find( {} , &lt;/p&gt;
{ &amp;lt;index keys&amp;gt; , _id : 0 }
&lt;p&gt; ).hint( &amp;lt;index keys&amp;gt; ).count()&lt;/p&gt;</comment>
                            <comment id="61769" author="antoine" created="Fri, 21 Oct 2011 06:31:42 +0000"  >&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;in this simple case it&apos;s all integer values, why would it need to access docs?&lt;/li&gt;
	&lt;li&gt;what is an example of case when it needs to access document? Here multikey is false.&lt;/li&gt;
	&lt;li&gt;is there another way to warm up just index?&lt;br/&gt;
thanks&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="61766" author="eliot" created="Fri, 21 Oct 2011 06:04:17 +0000"  >&lt;p&gt;This is because we can&apos;t check $ne just using index in many cases.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 21 Oct 2011 06:04:17 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 17 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 17 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>antoine</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hronnj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hriqpr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>22981</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht0buv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>