ola-hallengren index rebuild with multi thread and multiple days












0















Ola scripts for index maintenance work really well for smaller databases. For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.



How can we implement the solution to capture and then run the index optimization for certain duration of days and then reset. Can we also have it run in multiple threads?



We did develop a solution to achieve it, but the only problem we have is updating it on regular basis.










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.
















  • Can you include what you have worked on so far? What do you mean by updating it is a problem?

    – LowlyDBA
    May 5 '18 at 19:00











  • Keeping up to date with the latest versions.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:49











  • We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:53
















0















Ola scripts for index maintenance work really well for smaller databases. For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.



How can we implement the solution to capture and then run the index optimization for certain duration of days and then reset. Can we also have it run in multiple threads?



We did develop a solution to achieve it, but the only problem we have is updating it on regular basis.










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.
















  • Can you include what you have worked on so far? What do you mean by updating it is a problem?

    – LowlyDBA
    May 5 '18 at 19:00











  • Keeping up to date with the latest versions.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:49











  • We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:53














0












0








0








Ola scripts for index maintenance work really well for smaller databases. For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.



How can we implement the solution to capture and then run the index optimization for certain duration of days and then reset. Can we also have it run in multiple threads?



We did develop a solution to achieve it, but the only problem we have is updating it on regular basis.










share|improve this question
















Ola scripts for index maintenance work really well for smaller databases. For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.



How can we implement the solution to capture and then run the index optimization for certain duration of days and then reset. Can we also have it run in multiple threads?



We did develop a solution to achieve it, but the only problem we have is updating it on regular basis.







sql-server maintenance ola-hallengren






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 5 '18 at 19:02









LowlyDBA

7,07252542




7,07252542










asked May 5 '18 at 18:09









Srikar Reddy KasireddySrikar Reddy Kasireddy

1




1





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.















  • Can you include what you have worked on so far? What do you mean by updating it is a problem?

    – LowlyDBA
    May 5 '18 at 19:00











  • Keeping up to date with the latest versions.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:49











  • We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:53



















  • Can you include what you have worked on so far? What do you mean by updating it is a problem?

    – LowlyDBA
    May 5 '18 at 19:00











  • Keeping up to date with the latest versions.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:49











  • We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

    – Srikar Reddy Kasireddy
    May 7 '18 at 3:53

















Can you include what you have worked on so far? What do you mean by updating it is a problem?

– LowlyDBA
May 5 '18 at 19:00





Can you include what you have worked on so far? What do you mean by updating it is a problem?

– LowlyDBA
May 5 '18 at 19:00













Keeping up to date with the latest versions.

– Srikar Reddy Kasireddy
May 7 '18 at 3:49





Keeping up to date with the latest versions.

– Srikar Reddy Kasireddy
May 7 '18 at 3:49













We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

– Srikar Reddy Kasireddy
May 7 '18 at 3:53





We developed a solution where it captured the index stats in a table and loop the table for the duration of days we setup and rebuild or reorg the indices on everyday schedule. Once the max days is reached, the next run will start capturing the fresh stats of indices and run through same. We achieved parallel threads by running all this with sql agent jobs controleld by a controller job.

– Srikar Reddy Kasireddy
May 7 '18 at 3:53










1 Answer
1






active

oldest

votes


















0















For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.




This is very common for VLDBs. You can be a bit smatter and follow Paul Randal's Quick list of VLDB maintenance best practices. You can rebuild indexes ONLINE in Enterprise edition.



In your case since you are using Ola's Index Optimization scripts, you are running into endless index defragmentation which you can solve by being analyzing CommandLog table



I have given few more thoughts on Is a weekly rebuild of indexes a good idea? covering maxdop option.



I would say, if your databases are extremely big (TB size), atleast do a reorg instead of rebuild and manually update stats. This will put you in a good reasonable state since a reorg will start from where it got killed.



For running in parallel threads, you can drive of commandLog table and use powershell runspace (be careful of not spawing many threads - see Notes on usage of using runspace).






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%2f205937%2fola-hallengren-index-rebuild-with-multi-thread-and-multiple-days%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















    For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.




    This is very common for VLDBs. You can be a bit smatter and follow Paul Randal's Quick list of VLDB maintenance best practices. You can rebuild indexes ONLINE in Enterprise edition.



    In your case since you are using Ola's Index Optimization scripts, you are running into endless index defragmentation which you can solve by being analyzing CommandLog table



    I have given few more thoughts on Is a weekly rebuild of indexes a good idea? covering maxdop option.



    I would say, if your databases are extremely big (TB size), atleast do a reorg instead of rebuild and manually update stats. This will put you in a good reasonable state since a reorg will start from where it got killed.



    For running in parallel threads, you can drive of commandLog table and use powershell runspace (be careful of not spawing many threads - see Notes on usage of using runspace).






    share|improve this answer




























      0















      For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.




      This is very common for VLDBs. You can be a bit smatter and follow Paul Randal's Quick list of VLDB maintenance best practices. You can rebuild indexes ONLINE in Enterprise edition.



      In your case since you are using Ola's Index Optimization scripts, you are running into endless index defragmentation which you can solve by being analyzing CommandLog table



      I have given few more thoughts on Is a weekly rebuild of indexes a good idea? covering maxdop option.



      I would say, if your databases are extremely big (TB size), atleast do a reorg instead of rebuild and manually update stats. This will put you in a good reasonable state since a reorg will start from where it got killed.



      For running in parallel threads, you can drive of commandLog table and use powershell runspace (be careful of not spawing many threads - see Notes on usage of using runspace).






      share|improve this answer


























        0












        0








        0








        For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.




        This is very common for VLDBs. You can be a bit smatter and follow Paul Randal's Quick list of VLDB maintenance best practices. You can rebuild indexes ONLINE in Enterprise edition.



        In your case since you are using Ola's Index Optimization scripts, you are running into endless index defragmentation which you can solve by being analyzing CommandLog table



        I have given few more thoughts on Is a weekly rebuild of indexes a good idea? covering maxdop option.



        I would say, if your databases are extremely big (TB size), atleast do a reorg instead of rebuild and manually update stats. This will put you in a good reasonable state since a reorg will start from where it got killed.



        For running in parallel threads, you can drive of commandLog table and use powershell runspace (be careful of not spawing many threads - see Notes on usage of using runspace).






        share|improve this answer














        For multi terabyte databases with big indices, many partitions, and a small interval of schedule times I observed that the script always tends to rebuild same indices and never finishes.




        This is very common for VLDBs. You can be a bit smatter and follow Paul Randal's Quick list of VLDB maintenance best practices. You can rebuild indexes ONLINE in Enterprise edition.



        In your case since you are using Ola's Index Optimization scripts, you are running into endless index defragmentation which you can solve by being analyzing CommandLog table



        I have given few more thoughts on Is a weekly rebuild of indexes a good idea? covering maxdop option.



        I would say, if your databases are extremely big (TB size), atleast do a reorg instead of rebuild and manually update stats. This will put you in a good reasonable state since a reorg will start from where it got killed.



        For running in parallel threads, you can drive of commandLog table and use powershell runspace (be careful of not spawing many threads - see Notes on usage of using runspace).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 5 '18 at 20:16









        KinKin

        53.8k481191




        53.8k481191






























            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%2f205937%2fola-hallengren-index-rebuild-with-multi-thread-and-multiple-days%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