COMPRESS()

Overview

Compresses the given string and returns the binary string result.

USAGE

COMPRESS(string)

Argument Name

Description

string

The string to compress

DETAILS

COMPRESS() is a compression function that compresses a string and returns a binary value.

An empty input string results in an empty output value.

The binary value for a non-empty string starts with a 4-byte length of the input (LSB) followed by the compressed data.

A NULL is returned if the argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT HEX(COMPRESS('Now is the time!'));
+----------------------------------------------------------+
| HEX(COMPRESS('Now is the time!'))                        |
+----------------------------------------------------------+
| 10000000789CF3CB2F57C82C5628C9485528C9CC4D5504002FA10582 |
+----------------------------------------------------------+
SELECT LENGTH(COMPRESS('abc'));
+-------------------------+
| LENGTH(COMPRESS('abc')) |
+-------------------------+
|                      15 |
+-------------------------+
SELECT LENGTH(COMPRESS(REPEAT('a', 1000)));
+-------------------------------------+
| LENGTH(COMPRESS(REPEAT('a', 1000))) |
+-------------------------------------+
|                                  21 |
+-------------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES