SQL Interview: 19: Store why an index exists

SQL Interview: 19: Store why an index exists

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Medium

Question:

While developers don’t mind adding indexes to a database, most people are very nervous about ever removing them.

Tools let us see whether or not an index is being used, but it’s useful to know why the index was added in the first place.

What’s the easiest way to store that information, and in a way that stays associated with the index?

Answer:

You can add extended properties to an index. (And to other objects in a database)

An extended property can be used to record why an index was created.

2025-02-07