---
title: "ZSTD_COMPRESS"
description: "The ZSTD_COMPRESS SQL function compresses a blob using the Zstandard-algorithm."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/zstd-compress
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/zstd-compress
updated: 2026-08-28T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{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`): The `blob` to 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:
```sql
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:
```sql
select base64_encode(zstd_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpzdGQgY29tcHJlc3Npb24gbWV0aG9k'))

-------------------
KLUv/SA8vQEAwsMMFLAnHd2OTKNtYpi2ISYmwTDAZCECxao8IzN3TMax4dILZvUeu/Ui7ASy4iTxWPjMZwoIAA==
```