Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
/ pg_cryogen Public archive

Compressed append-only pluggable storage for PostgreSQL 12+

License

Notifications You must be signed in to change notification settings

adjust/pg_cryogen

Repository files navigation

Build Status experimental

pg_cryogen

pg_cryogen is an append-only compressed pluggable storage.

Dependencies

pg_cryogen requires liblz4 and libzstd development packages installed.

Build

After clone just run in command line:

make install

Or if postgres binaries are not in the PATH:

make install PG_CONFIG=/path/to/pg_config

Using

pg_cryogen implements pluggable storage API and hence requires PostgreSQL 12 or later. To use it as a storage it needs to be specified as an access method while creating a table. E.g.:

create extension pg_cryogen;
create table my_table (...) using pg_cryogen;

pg_cryogen is an append only storage meaning that only INSERT and COPY commands are supported for data modification. Due to specifics of current implementation only inserts to a single table per transaction are possible. Also storage is optimized for bulk inserts and will create at least one separate block for each INSERT/COPY command.

Both index scan and bitmap scans are implemented.

Compression parameters

pg_cryogen offers two compression methods: lz4, which provides on average better compression/decompression speed, and zstd, which provides better compression ratio. Since pluggable storage API currently does not provide ways to set custom parameters for storages, the only way to set them is by using GUCs:

  • pg_cryogen.compression_method: possible options are lz4 and zstd (default).
  • pg_cryogen.lz4_acceleration: lz4 specific parameter which specifies how fast compression would be; valid values are [1..50], where 1 is better compression ratio and higher value is better speed (default is 1);
  • pg_cryogen.zstd_compression_level: zstd specific parameter for compression level; valid values are [-5..22] (default is 1).

Those GUCs can be set in either in postgresql.conf or for any particular session.

Internals

Please refer to a separate document for details.