Skip to content

v2.1 refinement - nvarchar(1000) columns are indexed #47

@sjohansson

Description

@sjohansson

in several cases the code columns have been expanded to nvarchar(1000) to not limit any designs unnecessarily. however, these can/should then not be indexed, as SQL server fails if a too long a string is used as the code value.

Example deployment warning:

Creating Table [omd].[BATCH]...
Warning! The maximum key length for a nonclustered index is 1700 bytes. The index 'IX_OMD_BATCH' has maximum length of 2000 bytes. For some combination of large values, the insert/update operation will fail.
Creating Table [omd].[MODULE]...
Warning! The maximum key length for a nonclustered index is 1700 bytes. The index 'IX_OMD_MODULE_MODULE_CODE' has maximum length of 2000 bytes. For some combination of large values, the insert/update operation will fail. 

It might be prudent to strike a balance here, allowing long, but not too long strings, which then also allows for indexes to be applied without risk for engine failures.

Currently, only the batch and module tables have these as default, that is possibly a symptom of a minimal indexation, minimal default code complexity approach.

A suggestion would be to slim these columns to nvarchar(500) as default, down from 1000.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions