Event Sourcing Persistence

Greg's devTeach talk has various slides in which he presents a simple overview of persistence for event storage. In the video [at 39:30] he talks about how he doesn't use a relational database for storing his events, but he says that you could.

Because I have only superficially glanced at solutions like BigTable, HyperTable, and CouchDB, I'm still using a relational database on the back end. Here is a proposed schema for storing the state transitions for any and all events of a bounded context in a SQL Server relational database:

CREATE TABLE [dbo].[Aggregates]
(
[aggregate_id] [uniqueidentifier] NOT NULL,
[aggregate_type] [nvarchar](256) NOT NULL,
[snapshot_event_seq] [int] NOT NULL,
CONSTRAINT [PK_Aggregates] PRIMARY KEY CLUSTERED
([aggregate_id] ASC)
)

CREATE TABLE [dbo].[Events]
(
[aggregate_id] [uniqueidentifier] NOT NULL,
[event_seq] [int] NOT NULL,
[msg_type] [nvarchar](256) NOT NULL,
[msg_ver] [smallint] NOT NULL,
[msg_data] [varbinary](max) NOT NULL,
CONSTRAINT [PK_Events] PRIMARY KEY CLUSTERED
([aggregate_id] ASC, [event_seq] ASC)
)

Note that the data for the event messages is stored as a blob--much like serializing a DTO across the wire, but here message is serialized to a database.