• Eirikur Eiriksson (4/19/2015)


    SQL-DBA-01 (4/19/2015)


    Eirikur,

    Can you suggest how to use sample percent and other hints using sp_updatestats??????????....???????

    The table which has billions of records do u suggest running sp_updatestats???????????????????????????????????????

    Again reiterating the suggestion of using Ola Hallengren's SQL Server Index and Statistics Maintenance

    To answer your question, have a look at sys.dm_db_index_physical_stats and sys.dm_db_index_operational_stats.

    I went to Ola's site to see how to update statistics with sampling just to see if DBA1 is having issues finding it and it is very easy to find which parameter to provide.

    DBA1, if you want to see how to fix your code, at least get the Ola Hallengren index optimise script and see how he did what you want.

    I would say that it is the text book solution to any of your questions, compatible from 2005 all the way to 2014 (he is very thorough) and is freely available in the proc suggested at the location in Eirikur's post.

    Here is Brent Ozar giving a lesson on how to use Ola's script.

    http://www.brentozar.com/archive/2014/12/tweaking-defaults-ola-hallengrens-maintenance-scripts/

    Brad McGehee's post on Ola's script.

    https://www.simple-talk.com/sql/database-administration/automate-and-improve-your-database-maintenance-using-ola-hallengrens-free-script/

    I seriously doubt if the solution can be improved on, unless this is just a fact finding academic learning exercise.

    As an aside, I think Ola should open a Patreon account because all of us are using his code.

    Surely a few of us will happily put 10 Pound into an account for him, considering how much easier he has made life.

    Catch-all queries done right [/url]
    Gail Shaw's Performance Blog[/url]