Skip to content

Add Where Clause to Find overlapped statistics + DROP statement.sql #3

@EitanBlumin

Description

@EitanBlumin

@AndrewCLion suggests:

Great script but it recommends removing statistics that are not completely overlapping. If the "overlapped" statistic is a filtered index then the script will recommend removing the auto generated statistic but the statistic will then be auto-recreated again.
Adding " AND S.has_filter = 0" to the last where clause fixes this in a "sledgehammer" way.

Thanks, @AndrewCLion .

@VitalyBruk this is your script, please fix it as per Andrew's suggestion: https://github.com/MadeiraData/microsoft-dbas-club/blob/master/Health%20Check%20Scripts/Find%20overlapped%20statistics%20%2B%20DROP%20statement.sql

You can use this script for Redundant Indexes as reference as it is a similar use case: https://github.com/MadeiraData/microsoft-dbas-club/blob/master/Best%20Practices%20Checklists/Redundant%20Indexes%20Detailed.sql#L89

NOTE: This issue is a continuation of an identical issue on the old repository: MadeiraData/MadeiraToolbox#6

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions