Search code examples
cratedb

How to deal with time-series and table relations?


I have a few questions regarding CrateDB.

I have been told that CrateDB does not support foreign key relations. Why is that? or has CrateDB another way of dealing with relations between tables?

I have read that CrateDB is very efficient regarding time-series data (fast reads and writes). But I see that when creating a table for time series data, it is somewhat similar to other database, in that the table contains a timestamp- and value-columns. The examples I have seen, also have partition definition for the timestamp. Is that what makes all the difference or is there a special way of creating tables that deal with time-series values?

I see that there are CrateDB clients for Python, Java and PHP. Are there any clients for C++?


Solution

    • CrateDB is implemented as a Distributed Database. Its interface is SQL, but there are still some things that are done differently - also due to its distributed nature. It fulfills some part of a traditional RDBMS, but others not. Foreign keys are one of those features that are not supported and also hard to achieve in a distributed architecture focussed on speed.
    • In CrateDB data is stored in tables. So you can define any table you want, very similar to other databases. What makes it work timeseries data is once again its distributed nature as you can have a lot of parallel workers ingesting huge amounts of data, also its ability to store data in partitions as this helps you to reduce data window to look at and also its fast aggregations.
    • There is no official C++ driver. But CrateDB offers an HTTP endpoint. This might be an option for you. https://crate.io/docs/crate/reference/en/latest/interfaces/http.html