<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:32:41 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-13728] Index Intersection and Sort</title>
                <link>https://jira.mongodb.org/browse/SERVER-13728</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For 2.6, index intersection does not apply when the sort( ) operation requires an index completely separate from the query predicate. Do you have any plan to support index intersection for both query and sort in the future. Currently our query criteria are different from sort field, we have to create lots of compound indexes, which uses lots of memory. It would be nice if we only need to create single field indexes and let Mongo to choose them for both query and sort. It is ok to use hint to tell Mongo which index for query and which index for sort.&lt;/p&gt;</description>
                <environment></environment>
        <key id="133225">SERVER-13728</key>
            <summary>Index Intersection and Sort</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="jimwang">Jim Wang</reporter>
                        <labels>
                    </labels>
                <created>Thu, 24 Apr 2014 21:18:02 +0000</created>
                <updated>Wed, 10 Dec 2014 23:10:26 +0000</updated>
                            <resolved>Mon, 28 Apr 2014 18:25:41 +0000</resolved>
                                    <version>2.6.0</version>
                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="565802" author="david.storch" created="Mon, 28 Apr 2014 18:24:24 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jim.wang%40disney.com&quot; class=&quot;user-hover&quot; rel=&quot;jim.wang@disney.com&quot;&gt;jim.wang@disney.com&lt;/a&gt;,&lt;/p&gt;

&lt;h5&gt;&lt;a name=&quot;DoesMongoDB2.6supportquerysortindexintersection%3F&quot;&gt;&lt;/a&gt;Does MongoDB 2.6 support query + sort index intersection?&lt;/h5&gt;

&lt;p&gt;Yes, but with the limitation that query+sort index intersection requires predicates over both indices. I will reuse the example from my comment on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3071&quot; title=&quot;Index Intersection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3071&quot;&gt;&lt;del&gt;SERVER-3071&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Q: Will v2.6 support query + sort intersection?&lt;/b&gt;&lt;br/&gt;
A: Yes. One caveat is that the query must contain predicates over both indices.  Consider a collection with indices on {zipcode:1} and {last_name:1}.  We will not perform index intersection for db.phonebook.find({zipcode: &quot;12345&quot;}).sort({last_name: 1}). On the other hand, we will consider an index intersection plan for db.phonebook.find({zipcode: &quot;12345&quot;, last_name: /^S/}).sort({last_name: 1}).&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;As a workaround, you can provide a &quot;dummy&quot; predicate for the sort field. For instance, the query optimizer will consider index intersection plans for the following query:&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;   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.phonebook.find({zipcode: 12345, last_name: {$type: 2}}).sort({last_name: 1});&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 the $type predicate over &apos;last_name&apos; because it will match all documents with a string for &apos;last_name&apos;, and it will cause the optimizer to consider a query+sort intersection plan.&lt;/p&gt;

&lt;h5&gt;&lt;a name=&quot;Willthislimitationberelaxedinthefuture%3F&quot;&gt;&lt;/a&gt;Will this limitation be relaxed in the future?&lt;/h5&gt;

&lt;p&gt;Hopefully yes, but I can&apos;t promise anything as this work has not yet been scheduled.&lt;/p&gt;

&lt;h5&gt;&lt;a name=&quot;Canyouhinttouseaquerysortindexintersectionplan%3F&quot;&gt;&lt;/a&gt;Can you hint to use a query + sort index intersection plan?&lt;/h5&gt;

&lt;p&gt;Currently there is no way to hint an index intersection plan.&lt;/p&gt;

&lt;p&gt;I hope this is helpful information. Please let us know if you have any further questions. I&apos;m going to close this ticket, but feel free to re-open if you have further related questions or concerns.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Dave&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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 28 Apr 2014 18:24:24 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 42 weeks, 2 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, 42 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>jimwang</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlw47:</customfieldvalue>

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

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

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