Migrating SQL persisted Saga data

Leveraging 6th generation NServiceBus on a project with numerous sagas. Currently leveraging both SQL Transport and SQL Persistence.

Over time the refactoring of the system has ended up with 3 distinct types of order processing sagas that have been boiled down to storing the same two columns in the saga data (UserId and OrderId).


  1. There’s no guidance I’ve seen saying that sharing the same saga persistence table isn’t ok. Simultaneously I’ve not seen where it’s exactly said to be kosher either :slight_smile:

  2. If #2 is ok, migrating is as simple as moving the SQL rows into the new combined shared saga state table, correct?

The main differences are:

  • The name and type of the CorrelationId column.
  • The shape of the data in the JSON-serialized field. The SagaId column is a Guid so that will never overlap, but if you got a message that mapped to the CorrelationId, and the JSON data contained there didn’t deserialize to the saga data type, it would blow up.
  • The fact that there’s a unique index on the CorrelationId column. You couldn’t have 2 different-typed sagas with the same value in the CorrelationId, which is really just another way to say my previosu bullet.

Is there a problem with keeping them separate? It’s better for performance and just logical separation.

If the saga classes OR saga data classes are different, you should keep them separate.