Compression
Community
We highly recommend reading the blog post and tutorial about compression before trying to set it up for the first time.
Setting up compression on TimescaleDB requires users to first configure the hypertable for compression and then set up a policy for when to compress chunks.
Advanced usage of compression allows users to compress chunks manually, instead of automatically as they age.
Compressed chunks have the following limitations:
ROW LEVEL SECURITY
is not supported.- Constraints are not fully supported:
- Unique constraints (
UNIQUE
) are restricted to compressionSEGMENTBY
andORDER BY
columns. - Primary Keys (
PRIMARY KEY
) are restricted to compressionSEGMENTBY
andORDER BY
columns. - Constraints are restricted to compression
SEGMENTBY
columns when applicable. Otherwise they are unsupported.
- Unique constraints (
Restrictions
In general, compressing a hypertable does impose some limitations on the types of data modifications that can occur on data inside a compressed chunk. The table below provides a brief outline of allowed modifications based on the version of TimescaleDB you are currently running.
TimscaleDB Version | Supported data modifications on compressed chunks |
---|---|
1.5 - 2.0 | Data and schema modifications are not supported. |
2.1 - 2.2 | Schema may be modified on compressed hypertables. Data modification not supported. |
2.3 | Schema modifications and basic insert of new data are allowed. Deleting, updating and some advanced insert statements are not supported. |
Starting with TimescaleDB 2.1, users have the ability to modify the schema of hypertables that have compressed chunks. Specifically, you can add columns to and rename existing columns of such compressed hypertables.
Starting with TimescaleDB 2.3, users have the ability to insert data into compressed chunks and to enable compression policies on distributed hypertables.
Altering data of compressed chunks still has some limitations:
- You cannot execute
UPDATE
orDELETE
statements on compressed chunks. INSERT
is not fully supported on compressed chunks:- You cannot use the
ON CONFLICT
clause i.e. upserts are not supported. - You cannot use the
OVERRIDING
clause. - You cannot use the
RETURNING
clause.
- You cannot use the
- Triggers are not fully supported when inserting into compressed chunks:
- You cannot use
AFTER INSERT
row-level triggers (FOR EACH ROW
).
- You cannot use
- Constraints are not fully supported when inserting into compressed chunks:
- Unique constraints (
UNIQUE
) are not supported. - Primary Keys (
PRIMARY KEY
) are not supported.
- Unique constraints (