I’m designing an SQL Server database that needs to have quite a few (roughly 15) long varchar fields, most of which I want to allocate a length of at least 1024 or 2048. Since this will obviously go well beyond the page size of 8060, I realize the database will probably take a big performance hit any time this table is accessed.
I have also considered grouping these narratives into similar subjects and making 3 or 4 separate tables, or just creating a single table with a varchar(max) field and an int representing the narrative type:
create table Narrative
(
narrative varchar(max),
narrativeType int
)
- Will there be a significant performance hit with the original design?
- What types of best practices may be used when dealing with large text fields?
I’ve decided to go ahead and split these narratives into their own table with a 1:1 relationship with the primary table. I don’t suspect I will ever be querying the values in these
varcharfields, and there is no need to do any indexing on them. Further, they will be accessed much less frequently than any of the other fields in the original table, so pulling them into a separate table helps focus the database design and may even improve performance, since they will only need to be dealt with when absolutely necessary.