<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:45:01 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-37116] Query with sort ascending get response very slow</title>
                <link>https://jira.mongodb.org/browse/SERVER-37116</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have 30_000_000 Documents: {_id:long, owner:string, content:string}&lt;br/&gt;
I create index for &apos;owner&apos; field&lt;/p&gt;



&lt;p&gt;I have a query:&#160;{ &quot;_id&quot;: &lt;/p&gt;
{ $gt: NumberLong(22047817660001) }
&lt;p&gt;, &quot;ci&quot;: &quot;0938186066:0938186061&quot; }&lt;/p&gt;

&lt;p&gt;&#160; &#160;+ Case 1: do query with sort = &lt;b&gt;descending&lt;/b&gt; and limit = 50&#160; =&amp;gt; Receiving data in &lt;b&gt;0.002s&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160;+&#160;Case 1: do query with sort = &lt;b&gt;ascending&lt;/b&gt; and limit = 50&#160; =&amp;gt; Receiving data in &lt;b&gt;&lt;font color=&quot;#FF0000&quot;&gt;9s&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="603722">SERVER-37116</key>
            <summary>Query with sort ascending get response very slow</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13202">Works as Designed</resolution>
                                        <assignee username="nick.brewer">Nick Brewer</assignee>
                                    <reporter username="letrungtrung1987">L&#234; Trung Trung</reporter>
                        <labels>
                    </labels>
                <created>Thu, 13 Sep 2018 08:34:14 +0000</created>
                <updated>Fri, 27 Oct 2023 13:53:31 +0000</updated>
                            <resolved>Fri, 14 Sep 2018 19:26:05 +0000</resolved>
                                    <version>4.0.2</version>
                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2003873" author="letrungtrung1987" created="Fri, 14 Sep 2018 23:51:21 +0000"  >&lt;p&gt;I &#160;query and sort on my index _id , why query examine on many documnents?&#160;&lt;/p&gt;</comment>
                            <comment id="2003584" author="nick.brewer" created="Fri, 14 Sep 2018 19:25:54 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=letrungtrung1987&quot; class=&quot;user-hover&quot; rel=&quot;letrungtrung1987&quot;&gt;letrungtrung1987&lt;/a&gt; Your ascending query has to examine significantly more documents - when you perform an ascending sort, you are essentially telling the query to look from &lt;tt&gt;NumberLong(22047817660001)&lt;/tt&gt; to infinity, to find documents that meet your equality match. Most of the documents that meet this are the upper end of that range, so a descending query (which starts from infinity) is able to find the documents that match more quickly. &lt;/p&gt;

&lt;p&gt;Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the &lt;a href=&quot;https://groups.google.com/group/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user group&lt;/a&gt; or &lt;a href=&quot;https://stackoverflow.com/questions/tagged/mongodb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Stack Overflow with the &lt;tt&gt;mongodb&lt;/tt&gt; tag&lt;/a&gt;. A question like this involving more discussion would be best posted on the mongodb-user group.&lt;/p&gt;

&lt;p&gt;-Nick&lt;/p&gt;</comment>
                            <comment id="2002662" author="letrungtrung1987" created="Fri, 14 Sep 2018 02:09:07 +0000"  >&lt;p&gt;This files contains:&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160;+ Ascending Explain: &lt;a href=&quot;https://goo.gl/4J66sx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://goo.gl/4J66sx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160;+ Descending Explain: &lt;a href=&quot;https://goo.gl/3jhhtt&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://goo.gl/3jhhtt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;And i uploaded this information to your secure portal, please check it&lt;/p&gt;</comment>
                            <comment id="2002058" author="nick.brewer" created="Thu, 13 Sep 2018 16:53:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=letrungtrung1987&quot; class=&quot;user-hover&quot; rel=&quot;letrungtrung1987&quot;&gt;letrungtrung1987&lt;/a&gt; Can you provide &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/cursor.explain/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;explain()&lt;/tt&gt;&lt;/a&gt; output for both the ascending and descending queries? You can upload this information to our &lt;a href=&quot;https://10gen-httpsupload.s3.amazonaws.com/upload_forms/79ffc9ff-318a-4d4a-ac0d-12879bf494c5.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;secure portal&lt;/a&gt; to ensure that it is only available to MongoDB employees. &lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
-Nick&lt;/p&gt;</comment>
                            <comment id="2001528" author="letrungtrung1987" created="Thu, 13 Sep 2018 08:41:06 +0000"  >&lt;p&gt;&#160;+ Case 3:&#160; =&amp;gt; do query without sort =&#160;&lt;b&gt;ascending&lt;/b&gt;&#160;and limit = 50&#160; =&amp;gt; Receiving data in&#160;&lt;b&gt;0.002s&lt;/b&gt;&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>Thu, 13 Sep 2018 16:53:17 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 21 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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 21 weeks, 5 days ago
                        </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>letrungtrung1987</customfieldvalue>
            <customfieldvalue>nick.brewer</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu7uqf:</customfieldvalue>

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

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

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