> For the complete documentation index, see [llms.txt](https://docs.monokot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.monokot.io/time-series-and-stores/postgresql-connectivity/data-compression.md).

# 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:

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

and&#x20;

<pre class="language-sql"><code class="lang-sql"><strong>// set up automatic data compression call
</strong><strong>SELECT add_compress_chunks_policy('public.tssamples_data', INTERVAL '7 days');
</strong></code></pre>

You can read more about data compression in TimescaleDB [<mark style="color:blue;">here</mark>](https://docs.timescale.com/latest/using-timescaledb/compression).
