Skip to content
storage_engine

storage_engine

storage_engine : colcompress and rowcompress Table Access Methods with vectorized execution

Overview

ID Extension Package Version Category License Language
2450
storage_engine
storage_engine
1.3.4
OLAP
AGPL-3.0
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemas engine

release 1.2.3; SQL v1.2.1

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
1.3.4
18
17
16
15
14
storage_engine -
RPM
PIGSTY
1.3.4
18
17
16
15
14
storage_engine_$v -
DEB
PIGSTY
1.3.4
18
17
16
15
14
postgresql-$v-storage-engine -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
el8.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
el9.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
el9.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
el10.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
el10.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
d12.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
d12.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
d13.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
d13.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u22.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u22.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u24.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u24.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u26.x86_64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
u26.aarch64
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
PIGSTY 1.3.4
Package Version OS ORG SIZE File URL
storage_engine_18 1.3.4 el8.x86_64 pigsty 222.0 KiB storage_engine_18-1.3.4-1PIGSTY.el8.x86_64.rpm
storage_engine_18 1.3.4 el8.aarch64 pigsty 212.9 KiB storage_engine_18-1.3.4-1PIGSTY.el8.aarch64.rpm
storage_engine_18 1.3.4 el9.x86_64 pigsty 191.1 KiB storage_engine_18-1.3.4-1PIGSTY.el9.x86_64.rpm
storage_engine_18 1.3.4 el9.aarch64 pigsty 186.7 KiB storage_engine_18-1.3.4-1PIGSTY.el9.aarch64.rpm
storage_engine_18 1.3.4 el10.x86_64 pigsty 194.7 KiB storage_engine_18-1.3.4-1PIGSTY.el10.x86_64.rpm
storage_engine_18 1.3.4 el10.aarch64 pigsty 188.9 KiB storage_engine_18-1.3.4-1PIGSTY.el10.aarch64.rpm
postgresql-18-storage-engine 1.3.4 d12.x86_64 pigsty 471.3 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~bookworm_amd64.deb
postgresql-18-storage-engine 1.3.4 d12.aarch64 pigsty 458.6 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~bookworm_arm64.deb
postgresql-18-storage-engine 1.3.4 d13.x86_64 pigsty 472.5 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~trixie_amd64.deb
postgresql-18-storage-engine 1.3.4 d13.aarch64 pigsty 460.7 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~trixie_arm64.deb
postgresql-18-storage-engine 1.3.4 u22.x86_64 pigsty 500.0 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~jammy_amd64.deb
postgresql-18-storage-engine 1.3.4 u22.aarch64 pigsty 493.0 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~jammy_arm64.deb
postgresql-18-storage-engine 1.3.4 u24.x86_64 pigsty 481.8 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~noble_amd64.deb
postgresql-18-storage-engine 1.3.4 u24.aarch64 pigsty 477.1 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~noble_arm64.deb
postgresql-18-storage-engine 1.3.4 u26.x86_64 pigsty 481.1 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~resolute_amd64.deb
postgresql-18-storage-engine 1.3.4 u26.aarch64 pigsty 476.1 KiB postgresql-18-storage-engine_1.3.4-1PIGSTY~resolute_arm64.deb

Source

pig build pkg storage_engine;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install storage_engine;		# install via package name, for the active PG version

pig install storage_engine -v 18;   # install for PG 18
pig install storage_engine -v 17;   # install for PG 17
pig install storage_engine -v 16;   # install for PG 16
pig install storage_engine -v 15;   # install for PG 15
pig install storage_engine -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'storage_engine';

Create this extension with:

CREATE EXTENSION storage_engine;

Usage

Sources: README, release 1.3.4, PGXN 1.3.4, PGXN changelog, META.json

storage_engine provides two PostgreSQL table access methods in the engine schema:

  • colcompress for column-oriented compressed storage with vectorized execution, min/max pruning, and parallel scans.
  • rowcompress for row-batch compression with parallel scans.
CREATE EXTENSION storage_engine;

Quick Start

Create tables using either access method:

CREATE TABLE events (
  ts timestamptz NOT NULL,
  user_id bigint,
  event_type text,
  value float8
) USING colcompress;

CREATE TABLE logs (
  id bigserial,
  logged_at timestamptz NOT NULL,
  message text
) USING rowcompress;

Main Tuning Knobs

Session-level GUCs documented upstream include:

  • storage_engine.enable_parallel_execution
  • storage_engine.min_parallel_processes
  • storage_engine.enable_vectorization
  • storage_engine.enable_custom_scan
  • storage_engine.enable_column_cache
  • storage_engine.enable_columnar_index_scan
  • storage_engine.enable_dml
  • storage_engine.stripe_row_limit
  • storage_engine.chunk_group_row_limit
  • storage_engine.compression_level

The README says these GUCs become visible once the library is loaded; add storage_engine to shared_preload_libraries if you want them available immediately in every session.

Types and Operators

engine.uint8 stores unsigned 64-bit values for colcompress workloads that need the full 0 through 2^64 - 1 range. Upstream documents comparison operators (=, <>, <, <=, >, >=), B-tree and hash opclasses, casts to and from bigint, numeric, and text, plus engine.min, engine.max, and engine.sum aggregates.

Useful Management Functions

For colcompress tables:

SELECT engine.alter_colcompress_table_set(
  'events'::regclass,
  orderby => 'ts ASC, user_id ASC',
  compression => 'zstd',
  compression_level => 9
);

SELECT engine.colcompress_merge('events');
CALL engine.colcompress_repack('events');
CALL engine.colcompress_repack('events', 0.7);

In 1.3.4, engine.colcompress_repack(table_name regclass, min_fill_ratio float8 DEFAULT 0.9) is a procedure for online per-stripe defragmentation of colcompress tables. It repacks stripes whose live-row ratio falls below the threshold. Use engine.colcompress_merge() when you need the old full-table rewrite that globally sorts by the orderby key.

For rowcompress tables:

SELECT engine.alter_rowcompress_table_set(
  'logs'::regclass,
  batch_size => 10000,
  compression => 'zstd',
  compression_level => 5
);

SELECT engine.rowcompress_repack('logs');

When to Use Which AM

  • Use colcompress for analytical scans, aggregates, and range predicates where projection, vectorization, and stripe/chunk pruning pay off.
  • Use rowcompress for append-heavy logs or wide rows that are usually fetched together, where compression matters more than column projection.
  • For point lookups on colcompress, upstream recommends enabling storage_engine.enable_columnar_index_scan or per-table index_scan.

Caveats

  • Upgrade existing installations with ALTER EXTENSION storage_engine UPDATE TO '1.3.4';.
  • The old FUNCTION engine.colcompress_repack(regclass) alias was removed in 1.3.4. Existing callers should switch to CALL engine.colcompress_repack('table') for stripe defragmentation or SELECT engine.colcompress_merge('table') for the old full rewrite behavior.
  • colcompress and rowcompress do not support foreign keys or AFTER ROW triggers.
  • VACUUM FULL and CREATE UNLOGGED TABLE ... USING colcompress are not supported; upstream recommends the extension’s repack functions instead.
  • On colcompress, combining orderby with B-tree indexes can disable the sort-on-write path, and B-tree indexes on ordered columns can defeat stripe pruning for range queries. Use engine.colcompress_merge() after loading data when global ordering matters, and prefer index_scan => false for analytical tables.
Last updated on