best practise on statitics Update

sakuraime 2,321 Reputation points

If I would like to implement a manual update statistics , what are the criteria on choosing which table stats are required to be update and with with sampling rate ?

is it a recommendation to use a threshold slightly less than the following as the indicator to choose the table need to be update stats?

Threshold = √((1000)*Current table cardinality)

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,067 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Olaf Helper 42,386 Reputation points

    Why reinventing the wheel, use Ola Hallengren script:

    1 person found this answer helpful.

  2. Erland Sommarskog 103.5K Reputation points MVP

    I agree with Olaf's and Tom's recommendation, but to answer your question: it depends on your workload.

  3. CarrinWu-MSFT 6,866 Reputation points

    Hi @sakuraime ,

    As Olaf's and Tom's recommendation, you can try the script. And we usually perform database maintenance such as index rebuild or index reorganize. SQL Server automatically updates the statistics after the index rebuild. It is equivalent to update statistics with FULL SCAN however; it does not update the column statistics. We should update column statistics after index rebuild as well.

    Best regards,

    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  4. Erland Sommarskog 103.5K Reputation points MVP

    so what's the dependence ...

    Several things. For one thing, if you have disabled autostats, you will need to cover up for that.

    How is data updated and inserted? Randomly all over the existing data, for instance because the key is a guid? Or is it monotonically increasing like a date or an IDENTITY column? For something non-unique, how often does skewing change? All of a sudden one customer gets a lot more transactions.

    You will have to know your workload.

    Or depend on template numbers, but then we are back to Ola's scripts.

    0 comments No comments