I have a SQL Server database, and have run sp_blitz
against it. This pulled out that there are a couple of heaps on moderate size tables (a few hundred thousand rows in one case).
Most of these tables have a primary key (one does not, but I'll deal with that later). The primary key itself has an unusual name - i.e. not the default one, when most of the tables have a default primary key name (PK_tablename
).
There is an index with a name matching the primary key, which is unique and non-clustered.
I can rename the primary key, but I then think I should be creating a clustered index. If I do this, then I'll have duplicate indexes, so it would make sense to remove the non-clustered index. However, it's being used for the primary key.
If I move the primary key constraint from the old non-clustered index to the new clustered index:
- Does this make sense?
- Are there any things I should be aware of?
- What is the best method to do this?