<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:12:34 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-26580] allow using partial index on query where predicate matches only partial filter expression</title>
                <link>https://jira.mongodb.org/browse/SERVER-26580</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If I have partial index where partial filter expression is {x:1} it can be used for queries where the only condition is {x:1} (we would scan the entire index but that might be a lot faster than collection scan.&lt;/p&gt;

&lt;p&gt;It&apos;s currently possible to hint such an index, but it doesn&apos;t look like we ever choose or consider it.&lt;/p&gt;

&lt;p&gt;Possibly related &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20066&quot; title=&quot;Query planner should consider index scans on empty query predicates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20066&quot;&gt;&lt;del&gt;SERVER-20066&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="322861">SERVER-26580</key>
            <summary>allow using partial index on query where predicate matches only partial filter expression</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="asya.kamsky@mongodb.com">Asya Kamsky</reporter>
                        <labels>
                            <label>QFB</label>
                            <label>asya</label>
                    </labels>
                <created>Tue, 11 Oct 2016 19:35:54 +0000</created>
                <updated>Tue, 30 May 2023 14:58:28 +0000</updated>
                                                                            <component>Querying</component>
                                        <votes>5</votes>
                                    <watches>21</watches>
                                                                                                                <comments>
                            <comment id="5313238" author="eric.maciel@hive.com" created="Thu, 30 Mar 2023 18:57:10 +0000"  >&lt;p&gt;Is this resolved in any of the later versions of mongo? In particular the issue outlined here severely limits the utility of partialFilterExpression indexes or it requires us to have all of the fields in our partialFilterExpression also included in our index.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48777&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-48777&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3225171" author="asya" created="Fri, 26 Jun 2020 04:54:16 +0000"  >&lt;p&gt;The last example has a workaround - include the field from the partial filter expression in the index as another key.  This will allow fully covered plan. &lt;/p&gt;</comment>
                            <comment id="3210114" author="JIRAUSER1253358" created="Tue, 16 Jun 2020 15:57:24 +0000"  >&lt;p&gt;I recently stumbled in this problem, too:&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48777&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-48777&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;For us this is a critical issue, since it limit the usefulness of partial indices a lot.&lt;/p&gt;

&lt;p&gt;If this problem is not considered for development soon, than it should at least be reflected in the documentation:&lt;/p&gt;

&lt;p&gt;*&#160;&lt;a href=&quot;https://docs.mongodb.com/manual/core/query-optimization/#covered-query&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/query-optimization/#covered-query&lt;/a&gt;&lt;br/&gt;
*&#160;&lt;a href=&quot;https://docs.mongodb.com/manual/core/index-partial/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/index-partial/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1677890" author="brad@mixmax.com" created="Wed, 20 Sep 2017 17:31:30 +0000"  >&lt;p&gt;Here&apos;s one more where the index is not used:&lt;/p&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;   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.test.insert({a: {b:2}})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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.test.ensureIndex({ &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;a.b&apos;&lt;/span&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;: 1}, {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;  partialFilterExpression: { &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;a&apos;&lt;/span&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;: { $exists: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&lt;/span&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; } }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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.test.find({&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;a.b&apos;&lt;/span&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;: 2}).explain(&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&lt;/span&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;)&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;p&gt;From &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31172&quot; title=&quot;index not used when it has partialFilterExpression and $exists on a query subset&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31172&quot;&gt;&lt;del&gt;SERVER-31172&lt;/del&gt;&lt;/a&gt; that is duped to this one&lt;/p&gt;</comment>
                            <comment id="1559616" author="kyle.suarez" created="Thu, 27 Apr 2017 19:56:39 +0000"  >&lt;p&gt;There are multiple requests in this ticket related to partial indexes and query planning. For my own sanity, I&apos;m going to list all the scenarios below.&lt;/p&gt;

&lt;p&gt;When the collection has a partial index {&lt;tt&gt;a: 1&lt;/tt&gt;} with &lt;tt&gt;partialFilterExpression: {b: 5&lt;/tt&gt;}:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;(1) Both &lt;tt&gt;find&lt;/tt&gt; and &lt;tt&gt;aggregate&lt;/tt&gt; should use the index if the query is compatible with the &lt;tt&gt;partialFilterExpression&lt;/tt&gt; (rather than using a COLLSCAN).&lt;/li&gt;
	&lt;li&gt;(2) &lt;tt&gt;distinct&lt;/tt&gt; should use a DISTINCT_SCAN over the index if the index (1) starts with the distinct key and (2) has a &lt;tt&gt;partialFilterExpression&lt;/tt&gt; that is compatible with the query (rather than a COLLSCAN).&lt;/li&gt;
	&lt;li&gt;(3) A &lt;tt&gt;find&lt;/tt&gt; with query {&lt;tt&gt;b: 5, a: {$gte: 1&lt;/tt&gt;}} should be covered by the index and not require a FETCH stage.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;When the collection also has a compound index {&lt;tt&gt;a: 1, b: 1&lt;/tt&gt;}:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;(4) &lt;tt&gt;aggregate&lt;/tt&gt; should prefer the (presumably more selective) partial index over the compound index. At present, it doesn&apos;t seem like the index is even considered.&lt;/li&gt;
	&lt;li&gt;(5) &lt;tt&gt;distinct&lt;/tt&gt; with distinct key &quot;a&quot; and query {&lt;tt&gt;b: 5, a: {$gte: 1&lt;/tt&gt;}} should consider a DISTINCT_SCAN on the partial index. (Currently, the only candidate plan is a DISTINCT_SCAN on the compound index. Strangely, the problem doesn&apos;t manifest if you replace &lt;tt&gt;$gte&lt;/tt&gt; with &lt;tt&gt;$exists&lt;/tt&gt;.)&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1486787" author="asya" created="Fri, 27 Jan 2017 15:12:48 +0000"  >&lt;p&gt;This is important for views where you want to have a single large collection appear as several smaller collections so every query under the hood will start with something like tenant_id=&apos;X&apos; and each view is for a specific tenant_id only (which would be easier if we fix &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25023&quot; title=&quot;no way to index the same fields with two different partial index filters&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25023&quot;&gt;&lt;del&gt;SERVER-25023&lt;/del&gt;&lt;/a&gt;)&lt;/p&gt;</comment>
                            <comment id="1470371" author="asya" created="Thu, 5 Jan 2017 18:36:59 +0000"  >&lt;p&gt;When I just specify &lt;/p&gt;
{b:5}
&lt;p&gt; as condition without sort, neither find nor aggregate considers the partial index at all (which is the original bug, it&apos;s not different between agg and find).&lt;/p&gt;

&lt;p&gt;But another discrepancy is which index we use whether it&apos;s an aggregation or find command (i.e. views vs collection), same two indexes as above, a:1 is partial on b:5 condition and also a regular index a:1, b:1.&lt;/p&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;   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;command: find          { find: &quot;foo&quot;,            filter: { b: 5.0, a: { $exists: true } }, sort: { a: 1.0 }, projection: { _id: 0.0, a: 1.0 } }                   planSummary: IXSCAN { a: 1.0 } keysExamined:5 docsExamined:5 cursorExhausted:1 nreturned:5 reslen:176 0ms&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;command: aggregate { aggregate: &quot;foo&quot;, pipeline: [ { $match: { b: 5.0, a: { $exists: true } } }, { $sort: { a: 1.0 } }, { $project: { _id: 0.0, a: 1.0 } } ], cursor: {} } planSummary: IXSCAN { a: 1.0, b: 1.0 } keysExamined:8 docsExamined:5 cursorExhausted:1 nreturned:5 reslen:176 0ms&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;p&gt;These two commands (find and aggregate) are identical in both meaning and results.  But aggregate gets the &quot;wrong&quot; index instead of perfectly valid partial index.  Is that an instance of agg preferring non-blocking stage (they are both non-blocking though!) so the issue is we don&apos;t properly realize partial index is non-blocking?&lt;/p&gt;

&lt;p&gt;Note that when I change a:$exists to be $gt:0 it doesn&apos;t change index selection, but find uses partial index but not as covered index which may be a separate bug:&lt;/p&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;   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;command: find         { find: &quot;foo&quot;,             filter: { b: 5.0, a: { $gt: 0.0 } }, sort: { a: 1.0 }, projection: { _id: 0.0, a: 1.0 } }                                          planSummary: IXSCAN { a: 1.0 } keysExamined:5 docsExamined:5 fromMultiPlanner:1 cursorExhausted:1 nreturned:5 reslen:176&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;command: aggregate { aggregate: &quot;foo&quot;, pipeline: [ { $match: { b: 5.0, a: { $gt: 0.0 } } }, { $sort: { a: 1.0 } }, { $project: { _id: 0.0, a: 1.0 } } ], cursor: {} } planSummary: IXSCAN { a: 1.0, b: 1.0 } keysExamined:8 docsExamined:0 cursorExhausted:1 nreturned:5 reslen:176&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;p&gt;Distinct shows strange behavior of using a:1,b:1 covered even though it&apos;s not most efficient, but even with condition on a added, it does not use covered on partial index.&lt;/p&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;   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;command: distinct { distinct: &quot;foo&quot;, key: &quot;a&quot;, query: { b: 5.0 } } planSummary: COLLSCAN keysExamined:0 docsExamined:9 numYields:0 reslen:57&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;command: distinct { distinct: &quot;foo&quot;, key: &quot;a&quot;, query: { b: 5.0, a: { $exists: true } } } planSummary: IXSCAN { a: 1.0 } keysExamined:5 docsExamined:5 numYields:0 reslen:57&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;command: distinct { distinct: &quot;foo&quot;, key: &quot;a&quot;, query: { b: 5.0, a: { $gt: 0.0 } } } planSummary: DISTINCT_SCAN { a: 1.0, b: 1.0 } keysExamined:4 docsExamined:0 numYields:0 reslen:57&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="1470320" author="asya" created="Thu, 5 Jan 2017 17:53:40 +0000"  >&lt;p&gt;Here&apos;s a case where we don&apos;t consider a partial index for distinct even though partial filter matches the query exactly.  &lt;/p&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;   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.foo.createIndex({a:1}, {partialFilterExpression:{b:5}});&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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.foo.distinct(&quot;a&quot;, {b:5})&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;p&gt;We use a collection scan even though we could use the index.    We can use DISTINCT_SCAN same as we would on index b:1,a:1 if it existed.&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="429523">SERVER-31172</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="280875">SERVER-23808</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="375967">SERVER-28889</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000dOGvbQAG, 5002K00000tRaL1QAK]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 12 Oct 2016 14:24:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        44 weeks, 6 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>asya.kamsky@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            44 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>brad@mixmax.com</customfieldvalue>
            <customfieldvalue>eric.maciel@hive.com</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
            <customfieldvalue>thilo@staffbase.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjtlz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2eun:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1671">Query 2017-05-08</customfieldvalue>
    <customfieldvalue id="1688">Query 2017-05-29</customfieldvalue>

                        </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|hsa0pj:</customfieldvalue>

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