Procedure stats getting cleared very often












0














Recent days, in our organisation, we are facing with a strange issue.



Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").



Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.



The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.



Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.



Kindly suggest some solutions.



Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )










share|improve this question



























    0














    Recent days, in our organisation, we are facing with a strange issue.



    Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").



    Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.



    The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.



    Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.



    Kindly suggest some solutions.



    Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )










    share|improve this question

























      0












      0








      0







      Recent days, in our organisation, we are facing with a strange issue.



      Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").



      Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.



      The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.



      Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.



      Kindly suggest some solutions.



      Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )










      share|improve this question













      Recent days, in our organisation, we are facing with a strange issue.



      Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").



      Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.



      The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.



      Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.



      Kindly suggest some solutions.



      Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )







      sql sql-server-2017






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 9:52









      user1532888

      84




      84
























          1 Answer
          1






          active

          oldest

          votes


















          0














          There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.



          This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.



          https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/






          share|improve this answer





















          • No. We don't use recompile on any of our stored procedures.
            – user1532888
            Nov 20 at 14:36











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390318%2fprocedure-stats-getting-cleared-very-often%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.



          This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.



          https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/






          share|improve this answer





















          • No. We don't use recompile on any of our stored procedures.
            – user1532888
            Nov 20 at 14:36
















          0














          There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.



          This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.



          https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/






          share|improve this answer





















          • No. We don't use recompile on any of our stored procedures.
            – user1532888
            Nov 20 at 14:36














          0












          0








          0






          There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.



          This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.



          https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/






          share|improve this answer












          There are a number of ways that the cache can get cleared from Overall instance config changes to Db changes through to using recompile in procedures.



          This link gives a good lead on what may be causing the issue but I think you are going to have to do some investigating.



          https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 10:27









          Stuart Grant

          395111




          395111












          • No. We don't use recompile on any of our stored procedures.
            – user1532888
            Nov 20 at 14:36


















          • No. We don't use recompile on any of our stored procedures.
            – user1532888
            Nov 20 at 14:36
















          No. We don't use recompile on any of our stored procedures.
          – user1532888
          Nov 20 at 14:36




          No. We don't use recompile on any of our stored procedures.
          – user1532888
          Nov 20 at 14:36


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390318%2fprocedure-stats-getting-cleared-very-often%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Create new schema in PostgreSQL using DBeaver

          Deepest pit of an array with Javascript: test on Codility

          Costa Masnaga