Search code examples
sqlsql-serverindexingkey

ASP.NET membership table and borderline duplicate keys from BlitzIndex


I am using the ASP.NET membership setup with a site and I am running BlitzIndex against it. It says the below items are borderline duplicate keys. What would be the best way to combine them or get rid of the extra data stored that is duplicate?

CREATE INDEX [aspnet_Users_Index2] ON [Test].[dbo].[aspnet_Users] (
    [ApplicationId]
    , [LastActivityDate]
) WITH (FILLFACTOR=100, ONLINE=?, SORT_IN_TEMPDB=?, DATA_COMPRESSION=?);

CREATE UNIQUE CLUSTERED INDEX [aspnet_Users_Index] ON [Test].[dbo].[aspnet_Users] (
    [ApplicationId]
    , [LoweredUserName]
) WITH (FILLFACTOR=100, ONLINE=?, SORT_IN_TEMPDB=?, DATA_COMPRESSION=?);

Solution

    1. This message is just a hint. For full details you need to read this. Its far from simple.

    2. Since they are the out-of-the-box indexes you should really just leave them alone. (Thanks Dan).

    3. For better understanding, consider this, the first column (and only column in common), is ApplicationId. Now in my experience its pretty rare to run ones membership database across multiple applications, so mostly ApplicationId will be a constant, and therefore not helpful for the index. So the main use of the index is actually the second column (even if you have multiple applications its the second column thats important) and they are quite different, indicating quite different access modes. Therefore you definitely don't want to try and combine them.