Assume a standard use case of customers and documents, where a customer can have many documents. Also assume that there will be a number of large files (anywhere from a couple of kilobytes up to a couple gigs) associated with each customer.
The DocumentStore
table must have, at least...
DocumentId INT IDENTITY PRIMARY KEY,
Stream VARBINARY(MAX) FILESTREAM NOT NULL,
DocGuid UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL
UNIQUE DEFAULT NEWID
What are the pros and cons of fields such as CustomerId, FileExtension, FileSize, Hash, CreatedBy, CreatedDate, ...
goitf in the same table or a different table (with a reference to the same DocumentId
, of course)?
This question mainly stems from the uncertainty of performance and paging, etc., when querying columns. (Assume an additional index on CustomerId, but probably no others.)