NServiceBus.Persistence.Sql icon indicating copy to clipboard operation
NServiceBus.Persistence.Sql copied to clipboard

SQL Server Outbox: Support using uniqueidentifier for messageid to reduce storage

Open ramonsmits opened this issue 1 year ago • 1 comments

Instead of using nvarchar(200) as the type for message id support uniqueidentifier to reduce the storage size of both the rows and the index.

In most environments message id will contain a UUID. It allows a string but that comes as a cost.

A uniqueidentifier is 16 bytes while currently nvarchar(200) results in 36 16 bit chars which results in 72 bytes per row.

This saves 56 bytes per row and would reduces the index size significantly.

ramonsmits avatar May 31 '24 10:05 ramonsmits

Solution suggestions

Ability to opt-in an assume UUID mode

Having the option to assume uuids would be very useful.

For example:

var outboxSettings = endpointConfiguration.EnableOutbox();
outboxSettings.UseUuidMessageId();

Hybrid table structure

Have 2 table structures and based on the incoming message ID value format to use the UUID table or the string value table

ramonsmits avatar May 31 '24 10:05 ramonsmits