<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:52:56 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-83712] Consider removing exact number of elements in $in from plan cache key</title>
                <link>https://jira.mongodb.org/browse/SERVER-83712</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In SBE plan cache key, we encode the number of elements in $in in it:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/66d182d1e50b7bfa8866ca2c44917638a3758d79/src/mongo/db/query/canonical_query_encoder.cpp#L744&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/66d182d1e50b7bfa8866ca2c44917638a3758d79/src/mongo/db/query/canonical_query_encoder.cpp#L744&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is done because of explode for sort SBE plan will have the number of branches equal to the number of elements in $in.&lt;/p&gt;

&lt;p&gt;However, this will lead to worse plan caching even for queries, where is no plan caching.&lt;/p&gt;

&lt;p&gt;It is a fact that we have users that use $in&apos;s with arbitrary amount of elements from 1 to thousands.&lt;/p&gt;

&lt;p&gt;Also, if a query have multiple $ins, it may lead to exponential growth.&lt;/p&gt;

&lt;p&gt;One suggestion is instead of generating a unique plan for every $in size when exploding for sort, we can generate plans for all powers of 2 (or 4) and use the smallest plan that can fit all $in values.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2511999">SERVER-83712</key>
            <summary>Consider removing exact number of elements in $in from plan cache key</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="1" iconUrl="https://jira.mongodb.org/images/icons/statuses/open.png" description="">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-execution">Backlog - Query Execution</assignee>
                                    <reporter username="ivan.fefer@mongodb.com">Ivan Fefer</reporter>
                        <labels>
                    </labels>
                <created>Wed, 29 Nov 2023 16:36:31 +0000</created>
                <updated>Thu, 18 Jan 2024 19:57:59 +0000</updated>
                                                                                                <votes>2</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="5918908" author="david.storch" created="Fri, 1 Dec 2023 18:06:48 +0000"  >&lt;p&gt;The simpler fix &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ivan.fefer%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;ivan.fefer@mongodb.com&quot;&gt;ivan.fefer@mongodb.com&lt;/a&gt; referred to above is happening under related ticket &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-83777&quot; title=&quot;Cap $in length in plan cache key with internalQueryMaxScansToExplode + 1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-83777&quot;&gt;&lt;del&gt;SERVER-83777&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="5916036" author="JIRAUSER1270969" created="Thu, 30 Nov 2023 16:51:08 +0000"  >&lt;p&gt;I decided to first implement simple fix to at least provide a finite bind to plan cache growth, before working on a more complex fix.&lt;/p&gt;</comment>
                            <comment id="5916035" author="JIRAUSER1270969" created="Thu, 30 Nov 2023 16:51:05 +0000"  >&lt;p&gt;I decided to first implement simple fix to at least provide a finite bind to plan cache growth, before working on a more complex fix.&lt;/p&gt;</comment>
                            <comment id="5915729" author="JIRAUSER1270969" created="Thu, 30 Nov 2023 15:35:11 +0000"  >&lt;p&gt;One problem is that even if we change explodeForSort code to pad the plan with empty IXSCANs, we can&apos;t do the same for $in size, as $in doesn&apos;t translate one-to-one to the number of exploded scans.&lt;/p&gt;

&lt;p&gt;Example `db.find({a: {$in: &lt;span class=&quot;error&quot;&gt;&amp;#91;1, 2, 3&amp;#93;&lt;/span&gt;}, b: {$in: &lt;span class=&quot;error&quot;&gt;&amp;#91;4, 5, 6&amp;#93;&lt;/span&gt;]}}).sort({c: 1})` - will explode into 9 IXSCANs.&lt;/p&gt;

&lt;p&gt;And $in size is not the only things that affect the number of IXSCANS - there are also $or.&lt;/p&gt;

&lt;p&gt;So bucketing solution is not correct, but proposed simple fix should be correct at least.&lt;/p&gt;</comment>
                            <comment id="5912957" author="JIRAUSER1270969" created="Wed, 29 Nov 2023 16:49:22 +0000"  >&lt;p&gt;Simple, but less efficient fix would be to add std::min(&amp;lt;$in size&amp;gt;, internalQueryMaxScansToExplode) when calculating plan cache key.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2513784">SERVER-83777</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2485075">SERVER-82548</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2542200">SERVER-84728</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25125"><![CDATA[Query Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 30 Nov 2023 16:32:34 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-3591</customfieldvalue>
                        </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>nicholas.zolnierz@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-query-execution</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>ivan.fefer@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i32fzb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2k8nw:</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="7261">QE 2023-12-11</customfieldvalue>
    <customfieldvalue id="7264">QE 2023-12-25</customfieldvalue>
    <customfieldvalue id="8043">QE 2024-01-08</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10555" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Story Points</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</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|i3224n:</customfieldvalue>

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