Transact SQL scripts written by
DBAs and Developers for
DBAs and Developers.
To submit a comment about this script
here or to submit your own script
clear out DTA indexes and statistics
When the Database Tuning Advisor fails or is aborted for whatever reason, it can leave behind its hypothetical indexes and stats. This script will remove these active indexes and stats from your database. Uses the is_hypothetical flag to find indexes. Uses the _dta prefix to find stats. This assumes that when you implement DTA-recommended stats, you change their name. If you have implemented DTA-recommneded stats and not changed their name, this script will remove those too.