index not exists

MohammadAmin Moazami 20 Reputation points
2023-02-06T16:23:10.3333333+00:00

After removing the indexes from the table, using the sys.indexes query, the removed indexes are still displayed. Although the deleted indexes do not exist in the table index folder.

User's image

If this query is Join with sys.partitions, we will have the output of the number of Object Explorer indexes.

I thought the problem was with SSMS, but the output in Sqlcmd also returned 16 records as in the first image.

User's image

User's image

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

Accepted answer
  1. PercyTang-MSFT 12,426 Reputation points Microsoft Vendor
    2023-02-07T02:00:46.3866667+00:00

    Hi @MohammadAmin Moazami

    In addition to the above two answers, you can also refer to the following links.

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b98ae1f2-a147-441a-91b1-1e657ec49341/hypothetical-indexes?forum=sqldatabaseengine

    https://stackoverflow.com/questions/21111927/should-i-delete-hypothetical-indexes

    Best regards,

    Percy Tang


    If the answer is the right solution, please click "Accept Answer". If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 101.4K Reputation points MVP
    2023-02-06T22:24:44.7233333+00:00

    Check the flag is_hypothetical in sys.indexes. This looks like indexes that the Database Tuning Advisor has considered, but which has not been actually created.

    1 person found this answer helpful.
    0 comments No comments

  2. Tom Phillips 17,716 Reputation points
    2023-02-06T22:39:00.51+00:00

    Those are not real indexes. They are generated statistics and "hypothetical" indexes created by DTA.

    See:

    https://blog.sqlauthority.com/2019/02/28/sql-server-how-to-drop-all-the-hypothetical-indexes-of-database/

    1 person found this answer helpful.
    0 comments No comments