ZSTD_COMPRESS
Syntax
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> ZSTD_COMPRESS[ZSTD_COMPRESS]:::quoted
ZSTD_COMPRESS --> End((END))
Purpose
The ZSTD_COMPRESS SQL function compresses a blob using the Zstandard-algorithm.
See also ZSTD_DECOMPRESS and ZLIB_COMPRESS.
Parameters:
- input (
blob): Theblobto compress.
Returns: a Zstandard-compressed version of the input.
Examples
The following example compresses and decompresses the nine ASCII characters ACME and retrieves the original text:
select blob_to_text(zstd_decompress(zstd_compress(ascii_to_blob('ACME'))))
-------------------
ACME
The following example compresses a text and retrieves the compressed blob encoded as base64:
select base64_encode(zstd_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpzdGQgY29tcHJlc3Npb24gbWV0aG9k'))
-------------------
KLUv/SA8vQEAwsMMFLAnHd2OTKNtYpi2ISYmwTDAZCECxao8IzN3TMax4dILZvUeu/Ui7ASy4iTxWPjMZwoIAA==