zstd
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4030 | zstd | No | Yes | No | Yes | No | Yes | - |
| Related | gzip bzip pg_parquet pg_bulkload file_fdw aws_s3 |
|---|
+varatt.h
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.2 | 1817161514 | pg_zstd | - |
| RPM | PIGSTY | 1.1.2 | 1817161514 | pg_zstd_$v | - |
| DEB | PIGSTY | 1.1.2 | 1817161514 | postgresql-$v-zstd | - |
Build
You can build the RPM / DEB packages for pg_zstd using pig build:
Install
You can install pg_zstd directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
| Function | Return Type |
|---|---|
zstd_compress(data bytea [, dictionary bytea [, level integer ]]) | bytea |
zstd_decompress(data bytea [, dictionary bytea ]) | bytea |
zstd_length(data bytea) | integer |
zstd_compress compresses the provided data and returns a Zstandard frame. A
preset dictionary may also be provided. The default compression level may
also be overriden, valid values range from 1 (best speed) to 22 (best
compression). The default level is 3.
If you want to override the compression level without using a dictionary, set
dictionary to NULL.
zstd_decompress decompresses the provided Zstandard frame in data and
returns the uncompressed data. A preset dictionary, matching the dictionary
used to compress the data, may also be provided.
zstd_length returns the decompressed length of the provided Zstandard frame.
If ZSTD_getFrameContentSize() is available it returns NULL if the length is
unknown. If unavailable, it isn’t possible to distinguish the error, unknown
decompressed length and zero decompressed length cases.
Example
Basic compress/decompress example:
Compress with level (1 for best speed, 22 for best compression, default to 3)
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)