<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:01:44 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-2982] too much data for sort() with no index, but index does exists, and run explain() it does show using BtreeCursor</title>
                <link>https://jira.mongodb.org/browse/SERVER-2982</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&amp;gt; db.error_types.getIndexes()&lt;br/&gt;
[&lt;br/&gt;
        {&lt;br/&gt;
                &quot;name&quot; : &quot;&lt;em&gt;id&lt;/em&gt;&quot;,&lt;br/&gt;
                &quot;ns&quot; : &quot;prod_ec.error_types&quot;,&lt;br/&gt;
                &quot;key&quot; : &lt;/p&gt;
{
                        &quot;_id&quot; : 1
                }
&lt;p&gt;        },&lt;br/&gt;
        {&lt;br/&gt;
                &quot;key&quot; : &lt;/p&gt;
{
                        &quot;app_id&quot; : 1,
                        &quot;digest&quot; : 1
                }
&lt;p&gt;,&lt;br/&gt;
                &quot;ns&quot; : &quot;prod_ec.error_types&quot;,&lt;br/&gt;
                &quot;background&quot; : true,&lt;br/&gt;
                &quot;name&quot; : &quot;app_id_1_digest_1&quot;&lt;br/&gt;
        },&lt;br/&gt;
        {&lt;br/&gt;
                &quot;key&quot; : &lt;/p&gt;
{
                        &quot;app_id&quot; : 1
                }
&lt;p&gt;,&lt;br/&gt;
                &quot;ns&quot; : &quot;prod_ec.error_types&quot;,&lt;br/&gt;
                &quot;background&quot; : true,&lt;br/&gt;
                &quot;name&quot; : &quot;app_id_1&quot;&lt;br/&gt;
        },&lt;br/&gt;
        {&lt;br/&gt;
                &quot;key&quot; : &lt;/p&gt;
{
                        &quot;app_id&quot; : 1,
                        &quot;app_version&quot; : -1,
                        &quot;is_resolved&quot; : 1,
                        &quot;updated_at&quot; : -1
                }
&lt;p&gt;,&lt;br/&gt;
                &quot;ns&quot; : &quot;prod_ec.error_types&quot;,&lt;br/&gt;
                &quot;background&quot; : true,&lt;br/&gt;
                &quot;name&quot; : &quot;app_id_1_app_version_-1_is_resolved_1_updated_at_-1&quot;&lt;br/&gt;
        }&lt;br/&gt;
]&lt;/p&gt;


&lt;p&gt;&amp;gt; db.error_types.find(&lt;/p&gt;
{ is_resolved: false, app_id: ObjectId(&apos;4d15ce1a9ea1a313dd017dba&apos;)}
&lt;p&gt;).sort(&lt;/p&gt;
{ updated_at: -1 }
&lt;p&gt;)          &lt;br/&gt;
error: &lt;/p&gt;
{ &quot;$err&quot; : &quot;too much data for sort() with no index&quot;, &quot;code&quot; : 10129 }

&lt;p&gt;but if I run the query with explain, BtreeCursor does used. (but it seems that mongodb picked the wrong one)&lt;/p&gt;

&lt;p&gt;&amp;gt; db.error_types.find(&lt;/p&gt;
{ is_resolved: false, app_id: ObjectId(&apos;4d15ce1a9ea1a313dd017dba&apos;)}
&lt;p&gt;).sort(&lt;/p&gt;
{ updated_at: -1 }
&lt;p&gt;).explain()&lt;br/&gt;
{&lt;br/&gt;
        &quot;cursor&quot; : &quot;BtreeCursor app_id_1_digest_1&quot;,&lt;br/&gt;
        &quot;nscanned&quot; : 82,&lt;br/&gt;
        &quot;nscannedObjects&quot; : 82,&lt;br/&gt;
        &quot;n&quot; : 82,&lt;br/&gt;
        &quot;scanAndOrder&quot; : true,&lt;br/&gt;
        &quot;millis&quot; : 52,&lt;br/&gt;
        &quot;indexBounds&quot; : {&lt;br/&gt;
                &quot;app_id&quot; : [&lt;br/&gt;
                        [&lt;br/&gt;
                                ObjectId(&quot;4d15ce1a9ea1a313dd017dba&quot;),&lt;br/&gt;
                                ObjectId(&quot;4d15ce1a9ea1a313dd017dba&quot;)&lt;br/&gt;
                        ]&lt;br/&gt;
                ],&lt;br/&gt;
                &quot;digest&quot; : [&lt;br/&gt;
                        [&lt;br/&gt;
                                &lt;/p&gt;
{
                                        &quot;$minElement&quot; : 1
                                }
&lt;p&gt;,&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;I added hint to the query, but still the same error&lt;/p&gt;

&lt;p&gt;&amp;gt;db.error_types.find(&lt;/p&gt;
{ is_resolved: false, app_id: ObjectId(&apos;4d15ce1a9ea1a313dd017dba&apos;)}
&lt;p&gt;).sort(&lt;/p&gt;
{ updated_at: -1 }
&lt;p&gt;).hint(&quot;app_id_1_app_version_-1_is_resolved_1_updated_at_-1&quot;)&lt;br/&gt;
error: &lt;/p&gt;
{ &quot;$err&quot; : &quot;too much data for sort() with no index&quot;, &quot;code&quot; : 10129 }


&lt;p&gt;&amp;gt; db.error_types.find(&lt;/p&gt;
{ is_resolved: false, app_id: ObjectId(&apos;4d15ce1a3ea7a313dd017dba&apos;)}
&lt;p&gt;).sort(&lt;/p&gt;
{ updated_at: -1 }
&lt;p&gt;).hint(&quot;app_id_1_app_version_-1_is_resolved_1_updated_at_-1&quot;)&lt;br/&gt;
error: &lt;/p&gt;
{ &quot;$err&quot; : &quot;too much data for sort() with no index&quot;, &quot;code&quot; : 10129 }
&lt;p&gt;&amp;lt;4d15ce1a9ea1a313dd017dba&apos;)}).sort(&lt;/p&gt;
{ updated_at: -1 }
&lt;p&gt;).hint(&quot;app_id_1_app_version_-1_is_resolved_1_updated_at_-1&quot;).explain()                                                        &lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor app_id_1_app_version_-1_is_resolved_1_updated_at_-1&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 0,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 0,&lt;br/&gt;
	&quot;n&quot; : 0,&lt;br/&gt;
	&quot;scanAndOrder&quot; : true,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;br/&gt;
		&quot;app_id&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				ObjectId(&quot;4d15ce1a9ea1a313dd017dba&quot;),&lt;br/&gt;
				ObjectId(&quot;4d15ce1a9ea1a313dd017dba&quot;)&lt;br/&gt;
			]&lt;br/&gt;
		],&lt;br/&gt;
		&quot;app_version&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				&lt;/p&gt;
{
					&quot;$maxElement&quot; : 1
				}
&lt;p&gt;,&lt;/p&gt;
				{
					&quot;$minElement&quot; : 1
				}
&lt;p&gt;			]&lt;br/&gt;
		],&lt;br/&gt;
		&quot;is_resolved&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				false,&lt;br/&gt;
				false&lt;br/&gt;
			]&lt;br/&gt;
		],&lt;br/&gt;
		&quot;updated_at&quot; : [&lt;br/&gt;
			[&lt;/p&gt;

&lt;p&gt;                                        &quot;$maxElement&quot; : 1&lt;br/&gt;
                                },&lt;/p&gt;
                                {
                                        &quot;$minElement&quot; : 1
                                }
&lt;p&gt;                        ]&lt;br/&gt;
                ]&lt;br/&gt;
        }&lt;br/&gt;
}&lt;/p&gt;


</description>
                <environment>ubuntu 10.04 64 bit</environment>
        <key id="16264">SERVER-2982</key>
            <summary>too much data for sort() with no index, but index does exists, and run explain() it does show using BtreeCursor</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="aaron">Aaron Staple</assignee>
                                    <reporter username="stonegao">Stone, Gao</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Apr 2011 03:38:01 +0000</created>
                <updated>Fri, 30 Mar 2012 14:26:44 +0000</updated>
                            <resolved>Tue, 21 Jun 2011 17:38:27 +0000</resolved>
                                    <version>1.8.0</version>
                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="38543" author="aaron" created="Tue, 21 Jun 2011 17:38:27 +0000"  >&lt;p&gt;No prob - feel free to reopen this ticket if you have further questions.&lt;/p&gt;</comment>
                            <comment id="38358" author="aaron" created="Mon, 20 Jun 2011 18:36:34 +0000"  >&lt;p&gt;Hi Stone,&lt;/p&gt;

&lt;p&gt;The second index will work but not the first.  Since app_version does not have an equality match in your query, it cannot appear in the index before the fields your are matching and sorting on.&lt;/p&gt;

&lt;p&gt;Aaron&lt;/p&gt;</comment>
                            <comment id="37871" author="stonegao" created="Thu, 16 Jun 2011 15:07:11 +0000"  >&lt;p&gt;Sorry for the inconvenience.&lt;/p&gt;

&lt;p&gt;I mean if I create an index : &lt;/p&gt;
{ app_version : 1, app_id : 1, is_resolved : 1, updated_at: -1 }
&lt;p&gt;  or &lt;/p&gt;
{ app_id: 1, is_resolved: 1, updated_at: -1 }
&lt;p&gt;  it will work?&lt;/p&gt;</comment>
                            <comment id="37612" author="aaron" created="Wed, 15 Jun 2011 04:03:30 +0000"  >&lt;p&gt;The index names you provided don&apos;t match names that would come from our normal name generation methods.  If you want to ask about specific indexes, please use the standard key format, eg &lt;/p&gt;
{a:1}
&lt;p&gt; or &lt;/p&gt;
{b:1,c:-1}
&lt;p&gt;.  Thanks.&lt;/p&gt;</comment>
                            <comment id="37608" author="stonegao" created="Wed, 15 Jun 2011 03:32:43 +0000"  >&lt;p&gt;Thanks for the help. &lt;/p&gt;

&lt;p&gt;So if I create an index : app_version_app_id_1_-1_is_resolved_1_updated_at_-1 or app_id_1_-1_is_resolved_1_updated_at_-1, it will work? &lt;/p&gt;</comment>
                            <comment id="37407" author="aaron" created="Tue, 14 Jun 2011 00:24:53 +0000"  >&lt;p&gt;Hi Stone,&lt;/p&gt;

&lt;p&gt;Do you have any more questions related to this ticket?&lt;/p&gt;</comment>
                            <comment id="29639" author="aaron" created="Tue, 26 Apr 2011 07:21:36 +0000"  >&lt;p&gt;I think the main issue here is that the index is not ordered with respect to the sort spec that has been requested.  The query specifies equality constraints on app_id and is_resolved but not app_version, and the sort requested is on updated_at.  Since the only index containing updated_at is app_id_1_app_version_-1_is_resolved_1_updated_at_-1, the data must be sorted in memory to match the requested sort order.&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>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 26 Apr 2011 07:21:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 35 weeks, 1 day 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, 35 weeks, 1 day 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="10020"><![CDATA[Linux]]></customfieldvalue>

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

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21081</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|ht0c2f:</customfieldvalue>

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