Skip to content

Commit f68494c

Browse files
authored
Update for jsonb compression (#4566)
1 parent bb80c27 commit f68494c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

use-timescale/hypercore/compression-methods.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,26 @@ have a lot of repeated values, then the dictionary is the same size as the
279279
original data. TimescaleDB automatically detects this case, and falls back to
280280
not using a dictionary in that scenario.
281281

282+
#### JSONB compression
283+
284+
For JSONB columns, $TIMESCALE_DB uses a two-layer compression approach:
285+
286+
1. **$TIMESCALE_DB dictionary compression**: $TIMESCALE_DB attempts to apply
287+
its own dictionary compression to the JSONB data. This works well when JSONB
288+
values have high repetition. It does not perform when each JSONB value is unique or nearly unique.
289+
290+
2. **$PG TOAST compression**: if dictionary compression does not perform, $TIMESCALE_DB skips compression and allows $PG to handle the data using
291+
Oversized-Attribute Storage Technique (TOAST) compression. By default,
292+
$PG uses `pglz` compression. To configure $PG to use more
293+
modern compression algorithms like `lz4`, set the `default_toast_compression`
294+
configuration parameter.
295+
296+
To check your current TOAST compression setting:
297+
298+
```sql
299+
SHOW default_toast_compression;
300+
```
301+
282302
[decompress-chunks]: /use-timescale/:currentVersion:/compression/decompress-chunks
283303
[manual-compression]: /use-timescale/:currentVersion:/compression/manual-compression/
284304
[delta]: /use-timescale/:currentVersion:/hypercore/compression-methods/#delta-encoding

0 commit comments

Comments
 (0)