This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Most of the junior DBs are creating many indexes for testing, and even if it is not working, then they are taking help of SQL Server Database Engine Tuning Advisor.
Which is not a bad thing but not a good for all the times. Because Database Engine Tuning Advisor has its own some limitations like creating Hypothetical indexes or creating statistics for different objects. Sometimes, it is creating Hypothetical indexes on all the columns.
Hypothetical indexes are empty, and it doesn’t contain data. It holds the column level statistics. I will test the performance of Hypothetical Indexes later in some other post, but in this post, I am sharing the script for removing Hypothetical Indexes.
How to find Hypothetical Index?
You can also search Hypothetical object which is starting with “_dta”.
1 2 |
SELECT * FROM sys.indexes WHERE is_hypothetical = 1 |
How to remove Hypothetical Index?
You can drop like any other object.
1 |
DROP INDEX _dta_INDEX_NAME |
You can also create Hypothetical Index:
While creating an index, use WITH STATISTICS_ONLY for creating a Hypothetical Index. It will store in any file or filegroup and doesn’t contain any data.
1 2 |
CREATE INDEX test_hyp_idx ON Table_Name(Column_Name) WITH STATISTICS_ONLY=1 |
Leave a Reply