Particular / NServiceBus.Persistence.Sql

Native SQL Persistence for NServiceBus
https://docs.particular.net/persistence/sql/
Other
36 stars 27 forks source link

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

Open ramonsmits opened 1 month ago

ramonsmits commented 1 month ago

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 commented 1 month ago

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