Data Compression

Storing time series in PostgreSQL can be very demanding in terms of disk space consumption. For example, 500 time series changing every 500 ms will consume ~6000 MB of disk space per day. TimescaleDB provides a mechanism for automatically compressing data with a very high compression rate, for example, for the above case the size of compressed data will be ~350 MB. The store does not provide an automatic mechanism to set compression, but you can set it by running the following SQL scripts:

// set compression for the hypertable
ALTER TABLE public.tssamples_data SET
(
    timescaledb.compress,
    timescaledb.compress_segmentby = 'tag_id'
)

and

// set up automatic data compression call
SELECT add_compress_chunks_policy('public.tssamples_data', INTERVAL '7 days');

You can read more about data compression in TimescaleDB here.

Last updated