<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:55:44 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>[DOCS-8151] Definition of &quot;listQueryShapes&quot; does not match other definitions of query caching</title>
                <link>https://jira.mongodb.org/browse/DOCS-8151</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;The definition of the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/PlanCache.listQueryShapes/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&quot;PlanCache.listQueryShapes()&quot;&lt;/a&gt; states:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The query optimizer only caches the plans for those query shapes that can have more than one viable plan.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Certainly, this method only returns query shapes for those queries than can use either of two indexes, (e.g. {a:1} and {a:1, b:1})&lt;/p&gt;

&lt;p&gt;But the definition of when query plans are cached is different in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15225&quot; title=&quot;CachedPlanStage should execute for trial period and re-plan if query performs poorly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15225&quot;&gt;&lt;del&gt;SERVER-15225&lt;/del&gt;&lt;/a&gt;, which states:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The query optimizer caches plans for each query shape and reuses these plans for a time.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Does the query planner cache all past query plans or only those that have two viable plan? &lt;/p&gt;

&lt;p&gt;I suspect that the behavior of the listQueryShapes() method is that it does not return all cache query plans. &lt;/p&gt;</description>
                <environment></environment>
        <key id="295983">DOCS-8151</key>
            <summary>Definition of &quot;listQueryShapes&quot; does not match other definitions of query caching</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="ravind.kumar">Ravind Kumar</assignee>
                                    <reporter username="steven.hand">Steven Hand</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Jun 2016 20:40:29 +0000</created>
                <updated>Wed, 11 Jan 2017 21:47:11 +0000</updated>
                            <resolved>Fri, 8 Jul 2016 17:40:57 +0000</resolved>
                                    <version>mongodb-3.2</version>
                                    <fixVersion>01112017-cleanup</fixVersion>
                                    <component>manual</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1318440" author="steven.hand" created="Fri, 8 Jul 2016 17:40:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ravind.kumar&quot; class=&quot;user-hover&quot; rel=&quot;ravind.kumar&quot;&gt;ravind.kumar&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Let&apos;s close this ticket. &lt;/p&gt;
</comment>
                            <comment id="1315307" author="ravind.kumar" created="Wed, 6 Jul 2016 14:12:54 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=steven.hand&quot; class=&quot;user-hover&quot; rel=&quot;steven.hand&quot;&gt;steven.hand&lt;/a&gt;: If there are no objections, I&apos;d like to close this ticket as the existing documentation is correct as it stands. &lt;/p&gt;</comment>
                            <comment id="1304624" author="david.storch" created="Thu, 23 Jun 2016 19:25:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=steven.hand&quot; class=&quot;user-hover&quot; rel=&quot;steven.hand&quot;&gt;steven.hand&lt;/a&gt;, it is indeed the case that for queries which have only one solution, that the planner must do the work to construct the plan each time. Somewhat counterintuitively, I don&apos;t think that we would be saving much (if any) work by caching single-solution queries. The main benefit of the cache is that the system can skip plan selection; since MongoDB uses an empirical strategy for plan ranking, the plan selection phase actually invokes the query execution machinery, which can be expensive. When the winning plan is cached, the entire plan selection phase can be skipped, which can result in large latency savings.&lt;/p&gt;

&lt;p&gt;If there is just a single query plan, then the plan selection phase can also be skipped. The process of reconstituting a plan based on the plan cache entry is actually quite similar to the process of planning a single-solution query without the cache. Therefore, there is not necessarily a large performance benefit associated with caching single-solution queries. That said, we have an open ticket tracking precisely this work: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13341&quot; title=&quot;Cache single solution query plans&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13341&quot;&gt;SERVER-13341&lt;/a&gt;, whose title &quot;Cache single solution query plans&quot;. It is quite possible that there would be a small performance benefit associated with this change, in exchange for more data stored in the plan cache. More importantly, I think this would make the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/nav-plan-cache/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;plan cache introspection commands&lt;/a&gt; easier to use and reason about.&lt;/p&gt;</comment>
                            <comment id="1304211" author="steven.hand" created="Thu, 23 Jun 2016 14:41:51 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt;, would it be correct to say that we are constantly re-planning queries that have one have one solution (like only have one index containing the field being queried). If so, wouldn&apos;t the constant re-planning of queries rise to be a significant portion of the execution time for all queries of a given shape in cases of high query load on a given collection? &lt;/p&gt;</comment>
                            <comment id="1304202" author="steven.hand" created="Thu, 23 Jun 2016 14:37:44 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ravind.kumar&quot; class=&quot;user-hover&quot; rel=&quot;ravind.kumar&quot;&gt;ravind.kumar&lt;/a&gt;, as I understand it, we set &quot;internalQueryCacheReplanningEnabled:true&quot; by default starting in 3.0.7, as per &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20139&quot; title=&quot;Enable CachedPlanStage replanning by default in 3.0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20139&quot;&gt;&lt;del&gt;SERVER-20139&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1303651" author="david.storch" created="Wed, 22 Jun 2016 23:39:06 +0000"  >&lt;p&gt;Currently, we only cache a plan for query shapes that have at least two query solutions. If the only solution is a collection scan, or there is only a single indexed plan available to answer the query, then no cache entry will be created. So the documentation for PlanCache.listQueryShapes() is correct. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15225&quot; title=&quot;CachedPlanStage should execute for trial period and re-plan if query performs poorly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15225&quot;&gt;&lt;del&gt;SERVER-15225&lt;/del&gt;&lt;/a&gt; should probably be clarified, as is does make it sound like a cache entry is &lt;b&gt;always&lt;/b&gt; generated. Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=steven.hand&quot; class=&quot;user-hover&quot; rel=&quot;steven.hand&quot;&gt;steven.hand&lt;/a&gt; for pointing out this inconsistency!&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>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 22 Jun 2016 20:52:48 +0000</customfieldvalue>

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


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>jess.mokrzecki@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 31 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>ravind.kumar</customfieldvalue>
            <customfieldvalue>steven.hand</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmphb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsmslb:</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_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrz6gf:</customfieldvalue>

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