Should I maintain separate database for my data?

Great question! The answer is as usual - it depends.

Temporal workflows are stateful, so all the data related to the process of fulfilling an order doesn’t need to be stored in a separate database. However, Temporal doesn’t have advanced querying capabilities across multiple workflows. So listing orders, especially ones that were closed last year, is not something it can provide. Also, Temporal is not a storage for other data like customer address, payment information, etc.

My mental model is that workflow should be queried directly for the current state of an order while it is open. The DB is used to list and search for specific orders and maintain historical information. You never want workflows polling DB for some state field.

3 Likes