How to purge old files from pg_xlogs directory





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







0















I have an archive command copying WAL files from pg_xlogs to my archive directory. However, I notice that the pg_xlogs directory is growing in size with (but is limiting itself to around 7 files). What controls this "7" value? Is there a risk it will grow to a huge number of files?



How do I limit the number of log files, or even better, limit to no more than 48 hours worth? I found a similarly titled question here but it doesn't really apply. I'm using PostgreSQL version 8.4.20 (so settings/commands from v9 won't apply)



Can I just create a cron job that deletes files from pg_xlogs older than 48 hours? Will this crash/corrupt the pgsql server? Is there a better way?



Can I use my archive_command to delete the source file after moving to my archive directory?










share|improve this question
















bumped to the homepage by Community 14 mins ago


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






















    0















    I have an archive command copying WAL files from pg_xlogs to my archive directory. However, I notice that the pg_xlogs directory is growing in size with (but is limiting itself to around 7 files). What controls this "7" value? Is there a risk it will grow to a huge number of files?



    How do I limit the number of log files, or even better, limit to no more than 48 hours worth? I found a similarly titled question here but it doesn't really apply. I'm using PostgreSQL version 8.4.20 (so settings/commands from v9 won't apply)



    Can I just create a cron job that deletes files from pg_xlogs older than 48 hours? Will this crash/corrupt the pgsql server? Is there a better way?



    Can I use my archive_command to delete the source file after moving to my archive directory?










    share|improve this question
















    bumped to the homepage by Community 14 mins ago


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


















      0












      0








      0








      I have an archive command copying WAL files from pg_xlogs to my archive directory. However, I notice that the pg_xlogs directory is growing in size with (but is limiting itself to around 7 files). What controls this "7" value? Is there a risk it will grow to a huge number of files?



      How do I limit the number of log files, or even better, limit to no more than 48 hours worth? I found a similarly titled question here but it doesn't really apply. I'm using PostgreSQL version 8.4.20 (so settings/commands from v9 won't apply)



      Can I just create a cron job that deletes files from pg_xlogs older than 48 hours? Will this crash/corrupt the pgsql server? Is there a better way?



      Can I use my archive_command to delete the source file after moving to my archive directory?










      share|improve this question
















      I have an archive command copying WAL files from pg_xlogs to my archive directory. However, I notice that the pg_xlogs directory is growing in size with (but is limiting itself to around 7 files). What controls this "7" value? Is there a risk it will grow to a huge number of files?



      How do I limit the number of log files, or even better, limit to no more than 48 hours worth? I found a similarly titled question here but it doesn't really apply. I'm using PostgreSQL version 8.4.20 (so settings/commands from v9 won't apply)



      Can I just create a cron job that deletes files from pg_xlogs older than 48 hours? Will this crash/corrupt the pgsql server? Is there a better way?



      Can I use my archive_command to delete the source file after moving to my archive directory?







      postgresql write-ahead-logging






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 10 '18 at 23:22







      TSG

















      asked Feb 10 '18 at 23:15









      TSGTSG

      1385




      1385





      bumped to the homepage by Community 14 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 14 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














          Firstly PG 8.4 is no longer supported (since July 2014), you should move your databases to a supported version as soon as possible.



          The WAL configuration settings for the 8.4 version are documented here:



          https://www.postgresql.org/docs/8.4/static/runtime-config-wal.html



          In particular checkpoint_segments control the number of WAL files.



          You must not delete WAL files, either manually or with a cron job or with archive_command. This would definitely corrupt your database.



          WAL files may grow in number if archive_command is not working or lagging behind.






          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%2f197586%2fhow-to-purge-old-files-from-pg-xlogs-directory%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














            Firstly PG 8.4 is no longer supported (since July 2014), you should move your databases to a supported version as soon as possible.



            The WAL configuration settings for the 8.4 version are documented here:



            https://www.postgresql.org/docs/8.4/static/runtime-config-wal.html



            In particular checkpoint_segments control the number of WAL files.



            You must not delete WAL files, either manually or with a cron job or with archive_command. This would definitely corrupt your database.



            WAL files may grow in number if archive_command is not working or lagging behind.






            share|improve this answer




























              0














              Firstly PG 8.4 is no longer supported (since July 2014), you should move your databases to a supported version as soon as possible.



              The WAL configuration settings for the 8.4 version are documented here:



              https://www.postgresql.org/docs/8.4/static/runtime-config-wal.html



              In particular checkpoint_segments control the number of WAL files.



              You must not delete WAL files, either manually or with a cron job or with archive_command. This would definitely corrupt your database.



              WAL files may grow in number if archive_command is not working or lagging behind.






              share|improve this answer


























                0












                0








                0







                Firstly PG 8.4 is no longer supported (since July 2014), you should move your databases to a supported version as soon as possible.



                The WAL configuration settings for the 8.4 version are documented here:



                https://www.postgresql.org/docs/8.4/static/runtime-config-wal.html



                In particular checkpoint_segments control the number of WAL files.



                You must not delete WAL files, either manually or with a cron job or with archive_command. This would definitely corrupt your database.



                WAL files may grow in number if archive_command is not working or lagging behind.






                share|improve this answer













                Firstly PG 8.4 is no longer supported (since July 2014), you should move your databases to a supported version as soon as possible.



                The WAL configuration settings for the 8.4 version are documented here:



                https://www.postgresql.org/docs/8.4/static/runtime-config-wal.html



                In particular checkpoint_segments control the number of WAL files.



                You must not delete WAL files, either manually or with a cron job or with archive_command. This would definitely corrupt your database.



                WAL files may grow in number if archive_command is not working or lagging behind.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 12 '18 at 11:38









                Daniel VéritéDaniel Vérité

                17.9k33653




                17.9k33653






























                    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%2f197586%2fhow-to-purge-old-files-from-pg-xlogs-directory%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

                    ف. موراي أبراهام

                    صرب

                    كأس إنترتوتو