> 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).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.monokot.io/time-series-and-stores/postgresql-connectivity/data-compression.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
