user8280126
user8280126

Reputation:

Event Sourcing SQL Server Write Event Store Column

In EventSourcing Write Event Table in SQL Server: why is common design pattern to use varbinary(max) to store data? We are storing JSON API data. I see it in all the templates.

Upvotes: 1

Views: 445

Answers (1)

Constantin Galbenu
Constantin Galbenu

Reputation: 17683

According to this varbinary(max) is used when the column data entries exceed 8,000 bytes. So, most probably, the events stored in JSON format exceed 8,000 bytes and the maximum length is unknown. A Domain Event could be very small or very big and the Event store should permit any size to be persisted.

Also, using the binary format ensures that JSON strings are opaque to the SQL server and should be decoded properly by the software.

Upvotes: 2

Related Questions