How to find the number of tuples that are vacuum-eligible?












1















I am trying to find the number of vacuum-eligible tuples in one of our postgres tables. This is the output of vacuum verbose on that table



INFO:  "act_msgs": found 0 removable, 2217083 nonremovable row     versions in 314492 out of 314492 pages
DETAIL: 2185476 dead row versions cannot be removed yet.
There were 62133 unused item pointers.


Before running the vacuum the live and dead tuple counts were n_live_tup => 2204051 and n_dead_tup => 12370. After running the vacuum they are n_live_tup => 2217220 and n_dead_tup => 9. So it looks like if vacuum cannot remove the actually deleted tuples it adds those tuples to live_tup.



Now, we know that we have a long running transaction opened by the application and that is causing the auto vacuum not able to clean up the dead tuples. The application would do frequent inserts and deletes. How do i find the number of tuples that were actually deleted and would be vacuumed when that transaction is closed?










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I am trying to find the number of vacuum-eligible tuples in one of our postgres tables. This is the output of vacuum verbose on that table



    INFO:  "act_msgs": found 0 removable, 2217083 nonremovable row     versions in 314492 out of 314492 pages
    DETAIL: 2185476 dead row versions cannot be removed yet.
    There were 62133 unused item pointers.


    Before running the vacuum the live and dead tuple counts were n_live_tup => 2204051 and n_dead_tup => 12370. After running the vacuum they are n_live_tup => 2217220 and n_dead_tup => 9. So it looks like if vacuum cannot remove the actually deleted tuples it adds those tuples to live_tup.



    Now, we know that we have a long running transaction opened by the application and that is causing the auto vacuum not able to clean up the dead tuples. The application would do frequent inserts and deletes. How do i find the number of tuples that were actually deleted and would be vacuumed when that transaction is closed?










    share|improve this question














    bumped to the homepage by Community 7 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I am trying to find the number of vacuum-eligible tuples in one of our postgres tables. This is the output of vacuum verbose on that table



      INFO:  "act_msgs": found 0 removable, 2217083 nonremovable row     versions in 314492 out of 314492 pages
      DETAIL: 2185476 dead row versions cannot be removed yet.
      There were 62133 unused item pointers.


      Before running the vacuum the live and dead tuple counts were n_live_tup => 2204051 and n_dead_tup => 12370. After running the vacuum they are n_live_tup => 2217220 and n_dead_tup => 9. So it looks like if vacuum cannot remove the actually deleted tuples it adds those tuples to live_tup.



      Now, we know that we have a long running transaction opened by the application and that is causing the auto vacuum not able to clean up the dead tuples. The application would do frequent inserts and deletes. How do i find the number of tuples that were actually deleted and would be vacuumed when that transaction is closed?










      share|improve this question














      I am trying to find the number of vacuum-eligible tuples in one of our postgres tables. This is the output of vacuum verbose on that table



      INFO:  "act_msgs": found 0 removable, 2217083 nonremovable row     versions in 314492 out of 314492 pages
      DETAIL: 2185476 dead row versions cannot be removed yet.
      There were 62133 unused item pointers.


      Before running the vacuum the live and dead tuple counts were n_live_tup => 2204051 and n_dead_tup => 12370. After running the vacuum they are n_live_tup => 2217220 and n_dead_tup => 9. So it looks like if vacuum cannot remove the actually deleted tuples it adds those tuples to live_tup.



      Now, we know that we have a long running transaction opened by the application and that is causing the auto vacuum not able to clean up the dead tuples. The application would do frequent inserts and deletes. How do i find the number of tuples that were actually deleted and would be vacuumed when that transaction is closed?







      postgresql vacuum






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 26 '16 at 21:05









      bhaskarbhaskar

      61




      61





      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It clearly tells you right there..




          DETAIL: 2185476 dead row versions cannot be removed yet.




          That's how many versions are vacuum-eligible. They're not being vacuumed because you have a long running transaction holding a ACCESS SHARE lock on the table?



          See this answer.






          share|improve this answer

























            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f136667%2fhow-to-find-the-number-of-tuples-that-are-vacuum-eligible%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














            It clearly tells you right there..




            DETAIL: 2185476 dead row versions cannot be removed yet.




            That's how many versions are vacuum-eligible. They're not being vacuumed because you have a long running transaction holding a ACCESS SHARE lock on the table?



            See this answer.






            share|improve this answer






























              0














              It clearly tells you right there..




              DETAIL: 2185476 dead row versions cannot be removed yet.




              That's how many versions are vacuum-eligible. They're not being vacuumed because you have a long running transaction holding a ACCESS SHARE lock on the table?



              See this answer.






              share|improve this answer




























                0












                0








                0







                It clearly tells you right there..




                DETAIL: 2185476 dead row versions cannot be removed yet.




                That's how many versions are vacuum-eligible. They're not being vacuumed because you have a long running transaction holding a ACCESS SHARE lock on the table?



                See this answer.






                share|improve this answer















                It clearly tells you right there..




                DETAIL: 2185476 dead row versions cannot be removed yet.




                That's how many versions are vacuum-eligible. They're not being vacuumed because you have a long running transaction holding a ACCESS SHARE lock on the table?



                See this answer.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 13 '17 at 12:42









                Community

                1




                1










                answered Jan 13 '17 at 23:50









                Evan CarrollEvan Carroll

                31.9k968218




                31.9k968218






























                    draft saved

                    draft discarded




















































                    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%2f136667%2fhow-to-find-the-number-of-tuples-that-are-vacuum-eligible%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

                    Liste der Baudenkmale in Friedland (Mecklenburg)

                    Single-Malt-Whisky

                    Czorneboh