<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:17:06 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-48430] MongoDB is choosing the wrong index / execution plan.</title>
                <link>https://jira.mongodb.org/browse/SERVER-48430</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In load&#160; MongoDB log file, we can see a lot of slow queries. Most of them are not using the best index and consequently the best execution plan is not used. However, when I run the same queries by myself in mongo shell, the correct index is used. So why for same query, we don&apos;t have same execution plan ?&lt;/p&gt;

&lt;p&gt;Kindly find the log below using wrong index :&lt;/p&gt;

&lt;p&gt;2020-05-25T04:55:51.624+0000 I COMMAND &lt;span class=&quot;error&quot;&gt;&amp;#91;conn301319&amp;#93;&lt;/span&gt; command mydb.mycoll command: aggregate { aggregate: &quot;mycoll&quot;, pipeline: [ { $match: { networkId.$id: &lt;/p&gt;
{ $in: [ ObjectId(&apos;5e0ed9eb60b2533bda7a0fa8&apos;) ] }
&lt;p&gt;, status: &quot;0&quot;, alarmType: &quot;1&quot; } }, { $group: { _id: &lt;/p&gt;
{ networkId: &quot;$networkId&quot; }
&lt;p&gt;, alarmCount: { $sum: 1 } } } ] } planSummary: IXSCAN { status: 1 } keysExamined:35350 docsExamined:35350 numYields:280 nreturned:0 reslen:135 locks:{ Global: { acquireCount: &lt;/p&gt;
{ r: 574 }
&lt;p&gt;, acquireWaitCount: { r: 92 }, timeAcquiringMicros: { r: 1590945 } }, Database: { acquireCount: &lt;/p&gt;
{ r: 287 }
&lt;p&gt; }, Collection: { acquireCount: &lt;/p&gt;
{ r: 286 }
&lt;p&gt; } } protocol:op_query 1980ms&lt;/p&gt;

&lt;p&gt;Index On collection:&lt;/p&gt;

&lt;p&gt;db.getCollection(&apos;mycoll&apos;).getIndexes()&lt;br/&gt;
[&lt;br/&gt;
 {&lt;br/&gt;
 &quot;v&quot; : 1,&lt;br/&gt;
 &quot;key&quot; : &lt;/p&gt;
{
 &quot;_id&quot; : 1
 }
&lt;p&gt;,&lt;br/&gt;
 &quot;name&quot; : &quot;&lt;em&gt;id&lt;/em&gt;&quot;,&lt;br/&gt;
 &quot;ns&quot; : &quot;mydb.mycoll&quot;&lt;br/&gt;
 },&lt;/p&gt;

&lt;p&gt; {&lt;br/&gt;
 &quot;v&quot; : 1,&lt;br/&gt;
 &quot;key&quot; : &lt;/p&gt;
{
 &quot;networkId.$id&quot; : 1,
 &quot;status&quot; : 1,
 &quot;alarmType&quot; : 1
 }
&lt;p&gt;,&lt;br/&gt;
 &quot;name&quot; : &quot;networkId.$id_1_status_1_alarmType_1&quot;,&lt;br/&gt;
 &quot;ns&quot; : &quot;mydb.mycoll&quot;&lt;br/&gt;
 },&lt;/p&gt;

&lt;p&gt; {&lt;br/&gt;
 &quot;v&quot; : 2,&lt;br/&gt;
 &quot;key&quot; : &lt;/p&gt;
{
 &quot;status&quot; : 1
 }
&lt;p&gt;,&lt;br/&gt;
 &quot;name&quot; : &quot;status_1&quot;,&lt;br/&gt;
 &quot;ns&quot; : &quot;mydb.mycoll&quot;,&lt;br/&gt;
 &quot;background&quot; : true&lt;br/&gt;
 }&lt;br/&gt;
]&lt;/p&gt;</description>
                <environment></environment>
        <key id="1363247">SERVER-48430</key>
            <summary>MongoDB is choosing the wrong index / execution plan.</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="anansingh@netgear.com">Anand Singh</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 May 2020 06:28:05 +0000</created>
                <updated>Fri, 19 Jun 2020 06:31:19 +0000</updated>
                            <resolved>Wed, 27 May 2020 14:22:17 +0000</resolved>
                                    <version>3.4.23</version>
                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3215567" author="JIRAUSER1252663" created="Fri, 19 Jun 2020 06:31:19 +0000"  >&lt;p&gt;Hi carl.champain,&lt;/p&gt;

&lt;p&gt;We have upgraded MongoDB to 3.6 version but we are&#160; seeing&#160; this issue .&lt;/p&gt;</comment>
                            <comment id="3120050" author="carl.champain" created="Wed, 27 May 2020 14:22:09 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=anansingh%40netgear.com&quot; class=&quot;user-hover&quot; rel=&quot;anansingh@netgear.com&quot;&gt;anansingh@netgear.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;MongoDB 3.4 is already end-of-lifed, which means it is unsupported by us. We strongly recommend you upgrade to a&#160;&lt;a href=&quot;https://www.mongodb.com/support-policy&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;supported version&lt;/a&gt;.&#160;If you need assistance troubleshooting, I encourage you to ask our community by posting on the &lt;a href=&quot;http://community.mongodb.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Community Forums&lt;/a&gt; or on &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;. I will now close this ticket.&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;br/&gt;
Carl&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>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 27 May 2020 14:22:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 33 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>anansingh@netgear.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 33 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>anansingh@netgear.com</customfieldvalue>
            <customfieldvalue>carl.champain@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxn5hr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxadz3:</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|hxmrr3:</customfieldvalue>

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