<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:01:35 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-64978] Add metrics to track if a plan was recovered from the plan cache</title>
                <link>https://jira.mongodb.org/browse/SERVER-64978</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Currently there is no an easy way to tell if a specific plan has been recovered from the cache or not. The closest match would be to obtain a plan cache key (via explain, slow logs or profiler), find a corresponding plan cache entry with &lt;tt&gt;$planCacheStats&lt;/tt&gt;&#160;and see if the cached entry is active or not. If yes, then most likely the plan was recovered from the cache. But this is sort of unreliable way to check it due to a timing window when a plan cache entry has been created and got activated. That is, a plan could be created not from the cache and an inactive cache entry was added to the cache. In the same time a few other queries of a similar shape could be execute, turning the cached plan into active. When the user tries to follow the above procedure to figure out if the first plan was recovered from the cache, they would receive the wrong answer.&lt;/p&gt;

&lt;p&gt;Instead, we should consider adding a new flag similar to &lt;tt&gt;fromMultiPlanner&lt;/tt&gt;&#160;which could honestly indicate if the plan has been recovered from the cache.&lt;/p&gt;

&lt;p&gt;On a similar note, it would be very handy to track plan cache hits and misses via &lt;tt&gt;serverStatus&lt;/tt&gt;&#160;metrics.&lt;/p&gt;

&lt;p&gt;CC &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christopher.harris&quot; class=&quot;user-hover&quot; rel=&quot;christopher.harris&quot;&gt;christopher.harris&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kateryna.kamenieva&quot; class=&quot;user-hover&quot; rel=&quot;kateryna.kamenieva&quot;&gt;kateryna.kamenieva&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2009957">SERVER-64978</key>
            <summary>Add metrics to track if a plan was recovered from the plan cache</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="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="13201">Fixed</resolution>
                                        <assignee username="maddie.zechar@mongodb.com">Maddie Zechar</assignee>
                                    <reporter username="anton.korshunov@mongodb.com">Anton Korshunov</reporter>
                        <labels>
                    </labels>
                <created>Mon, 28 Mar 2022 10:13:42 +0000</created>
                <updated>Sun, 29 Oct 2023 21:40:29 +0000</updated>
                            <resolved>Mon, 10 Oct 2022 17:17:41 +0000</resolved>
                                                    <fixVersion>6.2.0-rc0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="4891476" author="xgen-internal-githook" created="Mon, 10 Oct 2022 17:16:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Maddie Zechar&apos;, &apos;email&apos;: &apos;mez2113@columbia.edu&apos;, &apos;username&apos;: &apos;madelinezec&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-64978&quot; title=&quot;Add metrics to track if a plan was recovered from the plan cache&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-64978&quot;&gt;&lt;del&gt;SERVER-64978&lt;/del&gt;&lt;/a&gt; Add metrics to track if a plan was recovered from the plan cache&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/dbd868972c766d7a272e7cb3fcd2f3c792b2dd83&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/dbd868972c766d7a272e7cb3fcd2f3c792b2dd83&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4826541" author="maddie.zechar" created="Wed, 14 Sep 2022 16:31:04 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kateryna.kamenieva%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;kateryna.kamenieva@mongodb.com&quot;&gt;kateryna.kamenieva@mongodb.com&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christopher.harris%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;christopher.harris@mongodb.com&quot;&gt;christopher.harris@mongodb.com&lt;/a&gt;, Anton has suggested we also add two new serverStatus metrics counters to accumulate plan cache hits and misses. Is this something either of you would find useful/valuable? If it would, I could perhaps file that as another quick win and do it after this ticket is closed.&lt;/p&gt;</comment>
                            <comment id="4819721" author="maddie.zechar" created="Mon, 12 Sep 2022 17:07:27 +0000"  >&lt;p&gt;draft PR for a POC of this ticket: &lt;a href=&quot;https://github.com/10gen/mongo/pull/7490/files&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/mongo/pull/7490/files&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4677308" author="david.storch" created="Wed, 13 Jul 2022 17:53:03 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christopher.harris%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;christopher.harris@mongodb.com&quot;&gt;christopher.harris@mongodb.com&lt;/a&gt; your understanding sounds more or less correct. However, I do think it&apos;s not ideal to infer whether or not a plan was recovered from the cache using the &lt;tt&gt;fromMultiPlanner&lt;/tt&gt; flag. This is because of the single-solution case: it may not be evident from the log line whether the query circumvented the multi-planned because it was recovered from the cache, or whether it was not multi-planned because there was only one query solution available.&lt;/p&gt;

&lt;p&gt;One important change that happened as part of the SBE plan cache project is that we now cache single-solution plans (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-64315&quot; title=&quot;Re-enable caching of single solution plans&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-64315&quot;&gt;&lt;del&gt;SERVER-64315&lt;/del&gt;&lt;/a&gt; and related tickets). Therefore, when &lt;tt&gt;fromMultiPlanner&lt;/tt&gt; is absent and there is just one query solution, it is impossible to tell from the log line whether or not the query used a cached plan. You might not use a cached plan if 1) this is the first instance of the query shape since the plan cache was last cleared, 2) the plan cache entry has since been invalidated or evicted due to DDL operations or LRU eviction, or 3) the plan cache exists but is inactive.&lt;/p&gt;

&lt;p&gt;I think this flag would be useful because it would provide incontrovertible proof that a query used the plan cache. This seems better than trying to guess based on the value of the &lt;tt&gt;fromMultiPlanner&lt;/tt&gt; flag. You currently have definitive information when &lt;tt&gt;fromMultiPlanner:true&lt;/tt&gt; appears, but lack the necessary information when it does not appear.&lt;/p&gt;</comment>
                            <comment id="4670284" author="christopher.harris" created="Mon, 11 Jul 2022 13:12:33 +0000"  >&lt;p&gt;I&apos;m &quot;for&quot; this idea in general.&#160; While I&apos;m pretty sure there is something here, I must admit that I&apos;m not sure I fully understand all of the details.&#160; It may be that I just have a stale understanding of things based on the classic engine which is no longer accurate.&lt;/p&gt;

&lt;p&gt;My impression was that &lt;tt&gt;fromMultiPlanner&lt;/tt&gt; &lt;em&gt;is&lt;/em&gt; the flag to tell if a plan was recovered from the cache or not. Assuming my definition of &quot;recovered from the cache&quot; is correct (which is basically &apos;used the entry in the cache and did not go through multiplanning), that&apos;s definitely how we&apos;ve been using it in the field.&#160; There&apos;s always been an asterisk here in that single solution plans aren&apos;t cached, but that definitionally means that the multiplanner wasn&apos;t used there either which is where the pain points usually are.&#160;&lt;/p&gt;

&lt;p&gt;So if the slow operation is captured (log, profiler), then the presence or absence of &lt;tt&gt;fromMultiPlanner&lt;/tt&gt; is the indicator of plan cache usage today. The &lt;tt&gt;explain&lt;/tt&gt; command bypasses the plan cache, so apart from the suggested workflow to obtain a plan cache key I don&apos;t think it is particularly relevant.&#160;&#160;&lt;/p&gt;

&lt;p&gt;If there is something more here in terms of logging that would be helpful given either a misunderstanding of my part or associated with changes for SBE (or further upcoming changes), then let&apos;s schedule this.&#160;&#160;&lt;/p&gt;

&lt;p&gt;Regarding the serverStatus aspect of this - I linked &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40863&quot; title=&quot;Add a serverStatus metric to track query planner invocations&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40863&quot;&gt;SERVER-40863&lt;/a&gt;.&#160; I may be biased, but I&apos;m all for getting that one added!&#160;&#160;&lt;/p&gt;</comment>
                            <comment id="4572418" author="david.storch" created="Wed, 25 May 2022 14:49:11 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christopher.harris%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;christopher.harris@mongodb.com&quot;&gt;christopher.harris@mongodb.com&lt;/a&gt; do you have an update on this? My feeling is that this is worth scheduling, perhaps even as part of the SBE plan cache project.&lt;/p&gt;</comment>
                            <comment id="4457884" author="JIRAUSER1257467" created="Tue, 5 Apr 2022 14:48:29 +0000"  >&lt;p&gt;We would like to get an opinion from Product if we wort doing and&#160; timeline/priority for this, without waiting for Quick Wins timelines&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="746342">SERVER-40863</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 5 Apr 2022 14:48:29 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 17 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2573</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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 17 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ana.meza@mongodb.com</customfieldvalue>
            <customfieldvalue>anton.korshunov@mongodb.com</customfieldvalue>
            <customfieldvalue>christopher.harris@mongodb.com</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>maddie.zechar@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0ootj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i07oyk:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0oayv:</customfieldvalue>

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