Temporal Workflow as domain object (DDD), and manage domain object state

There is no need to duplicate information stored in workflow variables in a separate database. The main reasons to use an external DB are:

  1. Indexing and aggregation. Suppose you need to search for specific information and aggregate it across multiple workflows in some application-specific way.
  2. Historical records. A completed workflow is deleted after the retention period. So if you need to keep the data for a long time, you can push it to a DB at the end of the workflow.
  3. Sometimes, multiple clients need high-frequency polls for a specific workflow state. Queries are not optimal if the rate of such requests is pretty high. In this case, polling an external DB/Redis might be a reasonable optimization.