All Projects → grahamedgecombe → pgzstd

grahamedgecombe / pgzstd

Licence: ISC license
Postgres module for Zstandard compression/decompression with preset dictionary support

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to pgzstd

sparkzstd
A zstd decompressor written in golang
Stars: ✭ 45 (+45.16%)
Mutual labels:  zstd, zstandard
ZRA
ZStandard Random Access (ZRA) allows random access inside an archive compressed using ZStandard
Stars: ✭ 21 (-32.26%)
Mutual labels:  zstd, zstandard
Compress
Optimized Go Compression Packages
Stars: ✭ 2,478 (+7893.55%)
Mutual labels:  zstd, zstandard
ratarmount
Random Access Read-Only Tar Mount
Stars: ✭ 217 (+600%)
Mutual labels:  zstd, zstandard
7 Zip Zstd
7-Zip with support for Brotli, Fast-LZMA2, Lizard, LZ4, LZ5 and Zstandard
Stars: ✭ 2,150 (+6835.48%)
Mutual labels:  zstd, zstandard
ZstdKit
An Objective-C and Swift library for Zstd (Zstandard) compression and decompression.
Stars: ✭ 22 (-29.03%)
Mutual labels:  zstd, zstandard
EasyCompressor
⚡ A compression library that implements many compression algorithms such as LZ4, Zstd, LZMA, Snappy, Brotli, GZip, and Deflate. It helps you to improve performance by reducing Memory Usage and Network Traffic for caching.
Stars: ✭ 167 (+438.71%)
Mutual labels:  zstd, zstandard
pyzstd
Python bindings to Zstandard (zstd) compression library, the API is similar to Python's bz2/lzma/zlib modules.
Stars: ✭ 4 (-87.1%)
Mutual labels:  zstd, zstandard
zstdmt
Multithreading Library for Brotli, Lizard, LZ4, LZ5, Snappy and Zstandard
Stars: ✭ 107 (+245.16%)
Mutual labels:  zstd, zstandard
sqlite zstd vfs
SQLite3 extension for read/write storage compression with Zstandard
Stars: ✭ 42 (+35.48%)
Mutual labels:  zstd, zstandard
Linux
XanMod: Linux kernel source code tree
Stars: ✭ 310 (+900%)
Mutual labels:  zstd
Lizard
Lizard (formerly LZ5) is an efficient compressor with very fast decompression. It achieves compression ratio that is comparable to zip/zlib and zstd/brotli (at low and medium compression levels) at decompression speed of 1000 MB/s and faster.
Stars: ✭ 408 (+1216.13%)
Mutual labels:  zstd
Zstd
Zstandard implementation in Wuffs
Stars: ✭ 107 (+245.16%)
Mutual labels:  zstd
Zstdnet
Zstd wrapper for .NET
Stars: ✭ 176 (+467.74%)
Mutual labels:  zstd
Squashfs Tools Ng
A new set of tools and libraries for working with SquashFS images
Stars: ✭ 76 (+145.16%)
Mutual labels:  zstd
Gozstd
go wrapper for zstd
Stars: ✭ 275 (+787.1%)
Mutual labels:  zstd
pyrus-cramjam
Thin Python wrapper to de/compression algorithms in Rust - lightweight & no dependencies
Stars: ✭ 40 (+29.03%)
Mutual labels:  zstd
P7zip
A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/).
Stars: ✭ 222 (+616.13%)
Mutual labels:  zstd
Zstd Rs
A rust binding for the zstd compression library.
Stars: ✭ 159 (+412.9%)
Mutual labels:  zstd
Hs Zstd
Bindings to the Zstandard library to make it usable from the Haskell programming language.
Stars: ✭ 45 (+45.16%)
Mutual labels:  zstd

pgzstd

Introduction

pgzstd is a PostgreSQL extension that provides functions for compressing and uncompressing Zstandard frames, with support for custom dictionaries.

Prerequisites

  • PostgreSQL headers, libraries and PGXS build infrastructure
  • pg_config must be in your PATH
  • Zstandard

Building

Run make to build the extension.

Installation

Run make install as root (e.g. with sudo) to install the extension.

Debian package

The repository also contains the files for building a Debian package, which can be done by running pg_buildext updatecontrol followed by dpkg-buildpackage. I distribute pre-built versions for stable amd64 Debian using the apt.postgresql.org repository in my personal APT repository. Run apt-get install postgresql-PGVERSION-zstd as root after setting up the repository.

Usage

Run CREATE EXTENSION zstd to install the extension in the current database. Three functions are provided:

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

gpe=# CREATE EXTENSION zstd;
CREATE EXTENSION
gpe=# SELECT zstd_compress('hello hello hello hello', 'hello hello', 3);
            zstd_compress
--------------------------------------
 \x28b52ffd2017450000000200291c6c1420
(1 row)

gpe=# SELECT convert_from(zstd_decompress('\x28b52ffd2017450000000200291c6c1420', 'hello hello'), 'utf-8');
      convert_from
-------------------------
 hello hello hello hello
(1 row)

gpe=# SELECT zstd_length('\x28b52ffd2017450000000200291c6c1420');
 zstd_length
-------------
          23
(1 row)

gpe=#

License

This project is available under the terms of the ISC license, which is similar to the 2-clause BSD license. See the LICENSE file for the copyright information and licensing terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].