Search code examples
sqldatabasepostgresqltimescaledbquestdb

Separate Domain Model from Time Series Data?


In a scenario where you have a rather complex domain model (20+ interliked tables) and a lot of time series data (multiple TB, references to the domain model), would you use two different DBMS, one to store the data from the domain model (e.g. PostgreSQL) and the other to store the time series data (e.g. QuestDB)?

Or is it considered best practice to move the domain model to the time series database or the time series data to the domain model database (e.g. TimescaleDB)?

Pros of separate DBMS:

  • separation of concerns
  • performance (optimized time series access)
  • compression (optimited time series compression)

Cons of separate DBMS:

  • no referential integrity
  • no "direct" JOINS with the domain model possible

Solution

  • For the specific case of QuestDB, it is not a OLTP database, but closer to a (very fast) OLAP. This means QuestDB can work with time-series data very efficiently and can do joins against tables (with or without a designated timestamp), but doesn't enforce any referential integrity of transactions.

    Depending on your specific use case, that might mean you cannot really use QuestDB as your only datastore, but as an analytical datastore where you send your time-series data.

    Having said so, I've seen some real-life use cases where QuestDB is the source of truth. So it is definitely possible to have a single database, but I would say in most non-trivial projects you will probably end up with purpose-built databases for different parts of your domain.

    Disclaimer: I work as a developer advocate at QuestDB