Forum Discussion

KarolFerek's avatar
KarolFerek
Copper Contributor
Dec 13, 2024
Solved

Cleanup of auto created statistics

Hello everyone, during annual database checkup i found that there were a lot of auto created statistics, which weren't used.  It seems that DBMS doesn't cleanup unused auto created statistic on his...
  • rodgerkong's avatar
    Dec 17, 2024

    You can drop the WA_ statistics manually. When the Query Optimizer does not find statistic it needs, it will automatically create it.

    But if the table is not modified frequancy, the statistic exists can be used by Query Optimizer without or with few updates.  Comparatively, process of creating statistic will slowdown query.  So if it's not very necessary, you'd better not to drop statistics manually. After SQL Server 2022, there is a option can drop statistics automatic.

    Check the document https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16

Resources