SQL Server - Extremely low avg_page_space_used_in_percent for heap table The 2019 Stack...

Do warforged have souls?

Are spiders unable to hurt humans, especially very small spiders?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

How do you keep chess fun when your opponent constantly beats you?

Presidential Pardon

"... to apply for a visa" or "... and applied for a visa"?

Loose spokes after only a few rides

Windows 10: How to Lock (not sleep) laptop on lid close?

Why not take a picture of a closer black hole?

60's-70's movie: home appliances revolting against the owners

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Working through the single responsibility principle (SRP) in Python when calls are expensive

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

US Healthcare consultation for visitors

Sub-subscripts in strings cause different spacings than subscripts

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Circular reasoning in L'Hopital's rule

What's the point in a preamp?

How to type a long/em dash `—`

Single author papers against my advisor's will?

Identify 80s or 90s comics with ripped creatures (not dwarves)

Does Parliament need to approve the new Brexit delay to 31 October 2019?

What information about me do stores get via my credit card?

What was the last x86 CPU that did not have the x87 floating-point unit built in?



SQL Server - Extremely low avg_page_space_used_in_percent for heap table



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Why index REBUILD does not reduce index fragmentatation with a page count > 1000?Why is SQL Server 2012 working set memory low?SQL Server: UPDATE permission for table variableDatabase fragmentation and heap SQL ServerHow to reproduce “Could not continue scan with NOLOCK due to data movement”SQL Server heap tables fragmentation monitoringDELETE on a heap tableBackup Compression Causing Corruption In SQL 2017 TDE DatabaseSorting A Column with all null values have strange behaviorPostgres heap vs SQL Server clustered index





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















While analyzing a SQL Server 2012 database bloat issue, I found that fragmentation might be a major contributor to how much space is being taken up by certain tables, so after some Googling, I'm looking into the sys.dm_db_index_physical_stats function to try to understand what's going on. Here's my query:



SELECT
index_id,
index_type_desc,
alloc_unit_type_desc,
avg_fragmentation_in_percent,
avg_page_space_used_in_percent,
record_count,
page_count,
min_record_size_in_bytes,
max_record_size_in_bytes,
avg_record_size_in_bytes
FROM sys.dm_db_index_physical_stats
(DB_ID(), NULL, NULL, NULL , 'SAMPLED')
WHERE OBJECT_ID = 516196889
ORDER BY avg_fragmentation_in_percent DESC;


And my results:
Fragmentation query results



There are 4 non-clustered indexes on the table, so I'm guessing those are what the top 4 result rows represent. I haven't figured out why the IN_ROW_DATA portion of the heap has such low page usage (6%). If I'm reading the results correctly, there are more pages for this part than there are rows, but max record size is less than 8kb, so I'm trying to understand how that's even possible. How do I find out what's causing this low page usage, and what are some things I can do to fix it?



Any help greatly appreciated!









share







New contributor




user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    While analyzing a SQL Server 2012 database bloat issue, I found that fragmentation might be a major contributor to how much space is being taken up by certain tables, so after some Googling, I'm looking into the sys.dm_db_index_physical_stats function to try to understand what's going on. Here's my query:



    SELECT
    index_id,
    index_type_desc,
    alloc_unit_type_desc,
    avg_fragmentation_in_percent,
    avg_page_space_used_in_percent,
    record_count,
    page_count,
    min_record_size_in_bytes,
    max_record_size_in_bytes,
    avg_record_size_in_bytes
    FROM sys.dm_db_index_physical_stats
    (DB_ID(), NULL, NULL, NULL , 'SAMPLED')
    WHERE OBJECT_ID = 516196889
    ORDER BY avg_fragmentation_in_percent DESC;


    And my results:
    Fragmentation query results



    There are 4 non-clustered indexes on the table, so I'm guessing those are what the top 4 result rows represent. I haven't figured out why the IN_ROW_DATA portion of the heap has such low page usage (6%). If I'm reading the results correctly, there are more pages for this part than there are rows, but max record size is less than 8kb, so I'm trying to understand how that's even possible. How do I find out what's causing this low page usage, and what are some things I can do to fix it?



    Any help greatly appreciated!









    share







    New contributor




    user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      While analyzing a SQL Server 2012 database bloat issue, I found that fragmentation might be a major contributor to how much space is being taken up by certain tables, so after some Googling, I'm looking into the sys.dm_db_index_physical_stats function to try to understand what's going on. Here's my query:



      SELECT
      index_id,
      index_type_desc,
      alloc_unit_type_desc,
      avg_fragmentation_in_percent,
      avg_page_space_used_in_percent,
      record_count,
      page_count,
      min_record_size_in_bytes,
      max_record_size_in_bytes,
      avg_record_size_in_bytes
      FROM sys.dm_db_index_physical_stats
      (DB_ID(), NULL, NULL, NULL , 'SAMPLED')
      WHERE OBJECT_ID = 516196889
      ORDER BY avg_fragmentation_in_percent DESC;


      And my results:
      Fragmentation query results



      There are 4 non-clustered indexes on the table, so I'm guessing those are what the top 4 result rows represent. I haven't figured out why the IN_ROW_DATA portion of the heap has such low page usage (6%). If I'm reading the results correctly, there are more pages for this part than there are rows, but max record size is less than 8kb, so I'm trying to understand how that's even possible. How do I find out what's causing this low page usage, and what are some things I can do to fix it?



      Any help greatly appreciated!









      share







      New contributor




      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      While analyzing a SQL Server 2012 database bloat issue, I found that fragmentation might be a major contributor to how much space is being taken up by certain tables, so after some Googling, I'm looking into the sys.dm_db_index_physical_stats function to try to understand what's going on. Here's my query:



      SELECT
      index_id,
      index_type_desc,
      alloc_unit_type_desc,
      avg_fragmentation_in_percent,
      avg_page_space_used_in_percent,
      record_count,
      page_count,
      min_record_size_in_bytes,
      max_record_size_in_bytes,
      avg_record_size_in_bytes
      FROM sys.dm_db_index_physical_stats
      (DB_ID(), NULL, NULL, NULL , 'SAMPLED')
      WHERE OBJECT_ID = 516196889
      ORDER BY avg_fragmentation_in_percent DESC;


      And my results:
      Fragmentation query results



      There are 4 non-clustered indexes on the table, so I'm guessing those are what the top 4 result rows represent. I haven't figured out why the IN_ROW_DATA portion of the heap has such low page usage (6%). If I'm reading the results correctly, there are more pages for this part than there are rows, but max record size is less than 8kb, so I'm trying to understand how that's even possible. How do I find out what's causing this low page usage, and what are some things I can do to fix it?



      Any help greatly appreciated!







      sql-server sql-server-2012





      share







      New contributor




      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      user3250365user3250365

      1




      1




      New contributor




      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user3250365 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          });


          }
          });






          user3250365 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f234708%2fsql-server-extremely-low-avg-page-space-used-in-percent-for-heap-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user3250365 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          user3250365 is a new contributor. Be nice, and check out our Code of Conduct.













          user3250365 is a new contributor. Be nice, and check out our Code of Conduct.












          user3250365 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • 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%2fdba.stackexchange.com%2fquestions%2f234708%2fsql-server-extremely-low-avg-page-space-used-in-percent-for-heap-table%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

          Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...