<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:39:02 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-15802] Query optimizer should always use equality predicate over unique index when possible</title>
                <link>https://jira.mongodb.org/browse/SERVER-15802</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;After upgrading sharded cluster (shard key {uid:1}) from 2.4.9 to 2.6.5 I&apos;ve began to notice  periodic and sudden significant performance drops caused by huge read queue and lock on different shards. Logs shows slow queries like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;lt;skpd&amp;gt; query mpfs.hidden_data query: { _id: &quot;5120d6d1c7624f319c35fdff9e596890&quot;, uid: &quot;230984277&quot; } planSummary: IXSCAN { uid: 1.0 } ntoskip:0 nscanned:28184 nscannedObjects:28184 keyUpdates:0 numYields:220 locks(micros) r:797191 nreturned:1 reslen:374 7134ms&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;This collection has indexes {uid: 1} and {_id: 1}, and in normal situation, queries like that uses &quot;_id&quot; index that is the fastest one.&lt;/p&gt;

&lt;p&gt;This problem seems to be very similar to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13675&quot; title=&quot;Plans with differing performance can tie during plan ranking&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13675&quot;&gt;&lt;del&gt;SERVER-13675&lt;/del&gt;&lt;/a&gt; but it&apos;s marked as fixed in 2.6.2.&lt;/p&gt;</description>
                <environment></environment>
        <key id="165316">SERVER-15802</key>
            <summary>Query optimizer should always use equality predicate over unique index when possible</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="david.storch@mongodb.com">David Storch</assignee>
                                    <reporter username="miga">Migalin Danila</reporter>
                        <labels>
                    </labels>
                <created>Fri, 24 Oct 2014 15:22:06 +0000</created>
                <updated>Thu, 25 Jun 2015 18:42:10 +0000</updated>
                            <resolved>Fri, 16 Jan 2015 22:17:41 +0000</resolved>
                                    <version>2.6.5</version>
                                    <fixVersion>2.6.8</fixVersion>
                    <fixVersion>3.0.0-rc6</fixVersion>
                                    <component>Querying</component>
                                        <votes>8</votes>
                                    <watches>21</watches>
                                                                                                                <comments>
                            <comment id="823783" author="xgen-internal-githook" created="Fri, 6 Feb 2015 20:26:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15802&quot; title=&quot;Query optimizer should always use equality predicate over unique index when possible&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15802&quot;&gt;&lt;del&gt;SERVER-15802&lt;/del&gt;&lt;/a&gt; if an equality over a single-field unique index can be used to index an AND, ignore all other indices&lt;/p&gt;

&lt;p&gt;(cherry picked from commit c3da2fc6642f143111d104c871f420d523f949b5)&lt;/p&gt;

&lt;p&gt;Conflicts:&lt;br/&gt;
	src/mongo/db/query/get_executor.cpp&lt;br/&gt;
	src/mongo/db/query/index_entry.h&lt;br/&gt;
	src/mongo/db/query/query_planner_test.cpp&lt;br/&gt;
	src/mongo/s/chunk.cpp&lt;br/&gt;
Branch: v2.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d148fd1b0cbaf6d19b91658598d0b7d4c2eb0a97&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d148fd1b0cbaf6d19b91658598d0b7d4c2eb0a97&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="806955" author="xgen-internal-githook" created="Fri, 16 Jan 2015 22:16:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15802&quot; title=&quot;Query optimizer should always use equality predicate over unique index when possible&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15802&quot;&gt;&lt;del&gt;SERVER-15802&lt;/del&gt;&lt;/a&gt; if an equality over a single-field unique index can be used to index an AND, ignore all other indices&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c3da2fc6642f143111d104c871f420d523f949b5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c3da2fc6642f143111d104c871f420d523f949b5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="803508" author="david.storch" created="Tue, 13 Jan 2015 17:43:09 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;We appreciate that there are index selection problems in MongoDB&apos;s query optimizer that affect non-unique indices. The assessment of our development team about this case was that&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;the scenario reported involving a unique index was severe enough to require a fix, and&lt;/li&gt;
	&lt;li&gt;the special case of a unique index has a safe and efficient solution.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;If the fix for the unique index case is not sufficient, feel free to raise a new ticket describing a separate scenario.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Dave&lt;/p&gt;</comment>
                            <comment id="803277" author="miga" created="Tue, 13 Jan 2015 12:50:28 +0000"  >&lt;p&gt;One small remark: original ticket was named &quot;Wrong index selection&quot;, and &lt;b&gt;non-unique&lt;/b&gt; indexes are affected by this issue too. &lt;/p&gt;</comment>
                            <comment id="762648" author="miga" created="Wed, 12 Nov 2014 19:53:07 +0000"  >&lt;p&gt;Thank you, Ramon, that&apos;s it.&lt;br/&gt;
Bad thing is that updates to collections are affected by subj too, but there is no hints for write operations (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1599&quot; title=&quot;support ability to pass hint to update&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1599&quot;&gt;&lt;del&gt;SERVER-1599&lt;/del&gt;&lt;/a&gt;). &lt;br/&gt;
In case of updates, slow-log looks like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;2014-11-12T22:48:16.206+0300 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn8625&amp;#93;&lt;/span&gt; update mpfs.user_data query: { _id: &quot;d3e90e0b09f14b98ada9831763f982aa&quot;, uid: &quot;197337546&quot; } update: {  ...... } nscanned:22066 nscannedObjects:0 nMatched:1 nModified:1 keyUpdates:1 numYields:172 locks(micros) w:215817 20844ms &lt;/p&gt;&lt;/blockquote&gt;</comment>
                            <comment id="762455" author="ramon.fernandez" created="Wed, 12 Nov 2014 17:49:51 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;, the behavior you&apos;re observing arises in the following scenario:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;indices on {&lt;tt&gt;_id:1&lt;/tt&gt;} and {&lt;tt&gt;uid:1&lt;/tt&gt;}&lt;/li&gt;
	&lt;li&gt;the following query is run:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.find({ _id: &quot;7277e1122d67768b4a0a1292b1a244ee&quot;, uid: &quot;208450197&quot; })&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;while there&apos;s a document with {&lt;tt&gt;_id: &quot;7277e1122d67768b4a0a1292b1a244ee&quot;&lt;/tt&gt;}, there are no documents with {&lt;tt&gt;uid:208450197&lt;/tt&gt;}, so the {&lt;tt&gt;uid:1&lt;/tt&gt;} plan is cached because the query planner observes it&apos;s faster than the {&lt;tt&gt;_id:1&lt;/tt&gt;} plan (the former returns &lt;tt&gt;nscanned:0&lt;/tt&gt;, the latter &lt;tt&gt;nscanned:1&lt;/tt&gt;)&lt;/li&gt;
	&lt;li&gt;subsequent queries with the {&lt;tt&gt;_id:1, uid:1&lt;/tt&gt;} shape use the the cached {&lt;tt&gt;uid:1&lt;/tt&gt;} plan instead of the better {&lt;tt&gt;_id:1&lt;/tt&gt;} plan; in your case this query showcases the issue:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.find({ _id: &quot;5120d6d1c7624f319c35fdff9e596890&quot;, uid: &quot;230984277&quot; })&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The way to address this in the server is not immediately clear, as a fix for this particular scenario may have undersired side-effects in other cases, so we&apos;re investigating a general solution. &lt;/p&gt;

&lt;p&gt;Until this issue is addressed, the workaround is to &lt;tt&gt;hint()&lt;/tt&gt; on the desired index. Feel free to watch this ticket for progress in this matter.&lt;/p&gt;</comment>
                            <comment id="761616" author="agodin" created="Tue, 11 Nov 2014 20:17:08 +0000"  >&lt;p&gt;Hi Ramon!&lt;br/&gt;
What is the state of this ticket. Do I need some kind of debug?&lt;/p&gt;</comment>
                            <comment id="761201" author="oc666" created="Tue, 11 Nov 2014 15:30:13 +0000"  >&lt;p&gt;See also this thread in the forum:&lt;br/&gt;
&lt;a href=&quot;https://groups.google.com/forum/#!topic/mongodb-user/XaX7CAkJUG4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!topic/mongodb-user/XaX7CAkJUG4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="752957" author="miga" created="Thu, 30 Oct 2014 20:00:59 +0000"  >&lt;p&gt;That&apos;s great.&lt;/p&gt;

&lt;p&gt;Anyway, I&apos;ve already collected information you asked, you can check it here (logs are pretty big) &lt;a href=&quot;https://yadi.sk/d/gXGjgvglcPxhB&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://yadi.sk/d/gXGjgvglcPxhB&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="752750" author="ramon.fernandez" created="Thu, 30 Oct 2014 17:39:24 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;, I think I&apos;m able to reproduce the same behavior you&apos;re observing, so no need to provide additional information for now. Please watch this ticket for status updates.&lt;/p&gt;</comment>
                            <comment id="751940" author="ramon.fernandez" created="Wed, 29 Oct 2014 20:54:31 +0000"  >&lt;p&gt;Sorry, my mistake &amp;#8211; &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15802?focusedCommentId=751361&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-751361&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;please try again&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="751924" author="miga" created="Wed, 29 Oct 2014 20:44:34 +0000"  >&lt;p&gt;Ramon, ugh, sorry, but your link leads to this ticket and I don&apos;t see any of your comments before this one:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Hi Migalin Danila; please see my previous post with detailed instructions on what additional information to collect. The purpose of using explain() is not to force the right index to be used (that would be hint()), but to gather more information on why the query is using the wrong index altogether.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Mb your comment is under lock?&lt;/p&gt;</comment>
                            <comment id="751892" author="ramon.fernandez" created="Wed, 29 Oct 2014 20:25:41 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;, here&apos;s &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15802?focusedCommentId=751361&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-751361&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;the link with the instructions&lt;/a&gt; on what additional information to provide.&lt;/p&gt;

&lt;p&gt;I agree having to use hints is not a good general solution, but we need this addition information to make progress investigating this ticket.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="751859" author="miga" created="Wed, 29 Oct 2014 19:53:58 +0000"  >&lt;p&gt;Ramon, sorry, can you post a link to instructions?&lt;br/&gt;
I&apos;ve used explain() to check hypothesis that problem was caused by wrong cached index (similar to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13675&quot; title=&quot;Plans with differing performance can tie during plan ranking&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13675&quot;&gt;&lt;del&gt;SERVER-13675&lt;/del&gt;&lt;/a&gt;), docs say:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;query optimizer deletes the query plan and re-evaluates after any of the following events:&lt;br/&gt;
...&lt;br/&gt;
You run a query with :method:`~cursor.explain().&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&apos;ve just deployed hotfix that uses hints for this kind of queries, but it doesn&apos;t looks like a good general solution. &lt;/p&gt;</comment>
                            <comment id="751706" author="ramon.fernandez" created="Wed, 29 Oct 2014 17:56:22 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;; please see my previous post with detailed instructions on what additional information to collect. The purpose of using &lt;tt&gt;explain()&lt;/tt&gt; is not to force the right index to be used (that would be &lt;tt&gt;hint()&lt;/tt&gt;), but to gather more information on why the query is using the wrong index altogether.&lt;/p&gt;</comment>
                            <comment id="751695" author="miga" created="Wed, 29 Oct 2014 17:46:38 +0000"  >&lt;p&gt;&quot;Status:Waiting For User Input Waiting For User Input&quot;&lt;br/&gt;
What additional information can I provide?&lt;/p&gt;

&lt;p&gt;I can confirm that explain() doesn&apos;t fix the problem, mongodb continues to use wrong index; the only way is to stepDown() master - mb just because most of queries moves to another mongodb instance that is not affected by subj.&lt;/p&gt;</comment>
                            <comment id="751361" author="ramon.fernandez" created="Wed, 29 Oct 2014 13:42:41 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=miga&quot; class=&quot;user-hover&quot; rel=&quot;miga&quot;&gt;miga&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;we&apos;ll need more information to diagnose this problem. Could you please follow the steps below and upload the resulting information? Note that your logs show two different collections, &lt;tt&gt;user_data&lt;/tt&gt; and &lt;tt&gt;hidden_data&lt;/tt&gt; &amp;#8211; I&apos;ve chosen one of them as the problem seems to appear in both, but please adjust if needed.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Increase the log level by running:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.adminCommand( { setParameter: 1, logLevel: 2 } )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;List of indexes in your collection:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.getIndexes()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;Display &lt;a href=&quot;http://docs.mongodb.org/manual/reference/method/PlanCache.listQueryShapes/#PlanCache.listQueryShapes&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;query shapes&lt;/a&gt; from the plan cache:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.getPlanCache().listQueryShapes()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;Run &lt;a href=&quot;http://docs.mongodb.org/manual/reference/method/PlanCache.getPlansByQuery/#plancache-getplansbyquery&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;getPlansByQuery&lt;/a&gt; on the offending query:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.getPlanCache().getPlansByQuery({ _id: &quot;7277e1122d67768b4a0a1292b1a244ee&quot;, uid: &quot;208450197&quot; })&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;Run the query with &lt;tt&gt;explain(true)&lt;/tt&gt;:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.user_data.find({ _id: &quot;7277e1122d67768b4a0a1292b1a244ee&quot;, uid: &quot;208450197&quot; }).explain(true)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
	&lt;li&gt;Re-set the log level to the previous value (probably 0 if you didn&apos;t change this before) to prevent logs from taking too much space:
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.adminCommand( { setParameter: 1, logLevel: 0 } )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;You can put each piece of information in a file, zip all files along with the &lt;tt&gt;mongod.log&lt;/tt&gt; log files from your cluster and post it to this ticket. If the resulting file is too large (hundreds of megabytes) please let me know before  and I&apos;ll send you different upload instructions.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;
</comment>
                            <comment id="749135" author="miga" created="Mon, 27 Oct 2014 13:40:29 +0000"  >&lt;p&gt;Well, looks like something is completely wrong - while observing subj on some shard, I&apos;ve got this in slow-logs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2014-10-27T16:28:35.062+0300 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1849900&amp;#93;&lt;/span&gt; query mpfs.user_data query: { _id: &quot;7277e1122d67768b4a0a1292b1a244ee&quot;, uid: &quot;208450197&quot; } planSummary: IXSCAN { uid: 1.0, data.mt: 1.0 } ntoskip:0 nscanned:206915 nscannedObjects:206915&lt;br/&gt;
 keyUpdates:0 numYields:1596 locks(micros) r:97662182 nreturned:0 reslen:20 249690ms&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;For some reason, &lt;/p&gt;
{uid:1, data.mt:1}
&lt;p&gt; index was choosen to serve {_id: xxxx, uid: yyyy} queries.&lt;/p&gt;

&lt;p&gt;I&apos;ve also tried to run db.coll.find(problem-query).explain() to re-evaluate query-plan as described in &lt;a href=&quot;http://docs.mongodb.org/manual/core/query-plans/#query-plan-revision&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;docs&lt;/a&gt;, but that  didn&apos;t change anything.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="171748">SERVER-16350</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="12729">SERVER-1599</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>18.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12451" key="com.atlassian.jira.plugin.system.customfieldtypes:multiversion">
                        <customfieldname>Backport Completed</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="14745">2.6.8</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 25 Oct 2014 00:55:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 1 week, 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 1 week, 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>agodin</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>miga</customfieldvalue>
            <customfieldvalue>oc666</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlkwv:</customfieldvalue>

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

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

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