The maximum length of the index
I have such a model:
EF core created this table for me:
Here we have a maximum length of 450 characters.
Can I safely change this to MAX?
4 Replies
.
Yes, but why should the name be longer than 450 characters?
it is a string / sentence of the translation in English.
My system works like this: @ Culture.Translate ("Hello {user}", User.Name);
@Alerin The problem won't be in EF specifically. Depending on the actual database engine, they have different restrictions. For example, MSSQL wouldn't allow you to have an index on a
NVARCHAR(MAX)
.
"900 bytes for a clustered index. 1,700 bytes for a nonclustered index. For SQL Server 2014 (12.x) and earlier, all versions supported 900 bytes for all index types."
https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=sql-server-ver16