multiple nvarchar(450) fields unsuitable for clustered indexes #5757
Labels
area-identity
Includes: Identity and providers
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
Milestone
The worst offender is dbo.AspNetUserLogins, with three (3) nvarchar(450) fields making up the primary key. SQL Server balks at this and it's a design flaw that contents that can legally fit in these fields could (together) make the record unsavable, due to a violation of the 900-byte maximum length for clustered indexes.
I can imagine this is all rather baked into the system at this point, but it's a design flaw in two ways:
All that having been said, I suppose in practice "this will never be a problem" with regard to (1), since the fields in practice are populated with relatively small guids, and "this will never be a problem" with regard to (2) because most systems don't have more than a few thousand logins, and often fewer than 100, I suppose.
The other two tables affected by this (as in, SQL Server throws a fit when you try to create the index) are:
dbo.AspNetUserRoles (requesting 1,800 bytes in index space per record)
dbo.AspNetUserTokens (requesting 1,800 bytes in index space per record)
My recommended solution is that fields be reduced to more ordinary sizes, going forward, and primary keys be defaulted to integers.
The text was updated successfully, but these errors were encountered: