Basically, I'm trying to understand if Timescale is /only/ useful for timeseries or if it has good-enough performance for other use-cases.
Basically, I'm trying to understand if Timescale is /only/ useful for timeseries or if it has good-enough performance for other use-cases.
You can also define arbitrary indexes on a hypertable; practically, these index definitions get "pushed down" to all chunks, so an index is built on each chunk.
Queries have two-stages:
1. Using "constraint exclusion" by looking at the SQL query and constaints on each chunk (e.g., their time interval), exclude certain chunks for the query.
2. "Push down" the query (often in parallel) to all non-excluded chunks, and collect/aggregate those results.
Various features in TimescaleDB will help even in your case:
1. You get parallelism to scan across chunks. If employing multi-node (TimescaleDB 2.x), you can parallelize these aggregations across servers.
2. You can employ native columnar compression, which gets like 94-97% compression rates, and allows you to organize your data based on selected keys (the "segmentby" parameter). So if you "segmentby" parent_id, it really collocates that data together, and enables much faster query.
Thanks for quesiton!
https://docs.timescale.com/latest/using-timescaledb/compress...
How does TimescaleDB compare to Clickhouse? Since you mentioned compression, I've been using Clickhouse to store bitemporal data, and have been amazed by its speed and compression levels. Unfortunately it's lacking in terms of relational modeling.
Would I get the best of two worlds with TimescaleDB? What are the tradeoffs?
TimescaleDB is basically (very) fancy PostgreSQL sharding and row-oriented, while ClickHouse is a column store.
Depending on what you need to do, ClickHouse dictionaries and JOINs might be good enough.
You are likely basing this off on an old version of TimescaleDB.
For the last year TimescaleDB has included native compression (in part by storing data in a columnar format):
https://blog.timescale.com/blog/building-columnar-compressio...
TimescaleDB now implements delta-delta, Gorilla, and other best-in-class compression algorithms:
https://blog.timescale.com/blog/time-series-compression-algo...
This has yielded 94%+ compression, which should make TimescaleDB and Clickhouse fairly similar in storage compression.
Once your hypertables balloon to large sizes, you may be able to store handily across many Postgres instances, but collating the sub-queries will be costly. Spilling to e.g. S3 is a potential solution, but brings with it a new bag of problems, not to mention cost.