Skip to content

citus_columnar

Citus columnar storage engine

citus · Citus columnar storage engine

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2401citus_columnarcitus15.0.0OLAPAGPL-3.0-onlyC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono
Relationships
Schemaspg_catalog
See Alsopg_mooncake columnar storage_engine orioledb pg_sorted_heap
Siblingscitus
SQL 15.0-1 on PG17–19. Conflicts with Hydra Columnar.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY15.0.019 18 17 16 15citus-
RPMPIGSTY15.0.019 18 17 16 15citus_$v-
DEBPIGSTY15.0.019 18 17 16 15postgresql-$v-citus-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
el8.aarch64N/APIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
el9.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
el9.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
el10.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
el10.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
d12.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
d12.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
d13.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
d13.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u22.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u22.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u24.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u24.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u26.x86_64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0
u26.aarch64PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 15.0.0PIGSTY 14.4.1PIGSTY 13.6.0

Source

pig build pkg citus;		# 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 citus;		# install by package name
pig install citus_columnar;		# install by extension name

pig install citus_columnar -v 19;   # install for PG 19
pig install citus_columnar -v 18;   # install for PG 18
pig install citus_columnar -v 17;   # install for PG 17

Create this extension with:

CREATE EXTENSION citus_columnar;

Usage

Sources:

citus_columnar ships in the Citus package and provides a columnar table access method for scan-heavy, append-oriented archival or analytical tables. On PG17–19, package 15.0.0 uses SQL 15.0-1.

PostgreSQLPackagecitus SQLcitus_columnar SQL
1513.6.013.6-113.5-1
1614.4.114.4-114.4-1
17–1915.0.015.0-115.0-1

Create a Columnar Table

CREATE EXTENSION citus_columnar;

CREATE TABLE events_archive (
  event_at timestamptz NOT NULL,
  tenant_id bigint NOT NULL,
  kind text,
  payload jsonb
) USING columnar;

citus_columnar itself does not require shared_preload_libraries. Preloading citus is still required when the database also uses the distributed citus extension.

Load and Query Data

Columnar storage groups rows into stripes and compresses columns in chunks. Bulk inserts in reasonably sized transactions produce better stripes than a stream of tiny transactions.

INSERT INTO events_archive
SELECT event_at, tenant_id, kind, payload
FROM events
WHERE event_at < now() - interval '90 days';

SELECT tenant_id, count(*), min(event_at), max(event_at)
FROM events_archive
GROUP BY tenant_id;

Convert with the Citus Extension

When the main citus extension is also preloaded and installed, use its helper to convert a local or distributed table:

SELECT alter_table_set_access_method('events_archive', 'columnar');
SELECT alter_table_set_access_method('events_archive', 'heap');

Conversion rewrites the table. Converting to columnar drops existing indexes, so inventory dependent indexes and constraints before running it and schedule enough disk and lock time for the rewrite.

alter_table_set_access_method() belongs to citus, not to standalone citus_columnar. Without the main extension, create a new USING columnar table and copy data into it instead of assuming this helper exists.

Tune Compression

Inspect and change table-level columnar options with the documented helpers:

SELECT alter_columnar_table_set(
  'events_archive',
  compression => 'zstd',
  compression_level => 3,
  stripe_row_limit => 150000,
  chunk_group_row_limit => 10000
);

New settings affect newly written stripes. Rewrite existing data when old stripes also need the new layout.

Operational Boundaries

  • Columnar tables are intended for append-heavy use. UPDATE and DELETE are not supported, and space left by rolled-back writes is not reclaimed through ordinary heap-style maintenance.
  • TOAST is not available; large values remain inline and can hit PostgreSQL’s row-size limits.
  • Row locks, AFTER ... FOR EACH ROW triggers, serializable isolation, logical decoding, foreign keys, unlogged tables, and several scan types are unsupported. Check the current upstream limitation list before adopting the access method.
  • Ordinary heap assumptions about indexes, vacuum, replication, triggers, and constraints do not automatically apply. Validate every required database feature against a representative columnar table.
  • The extension is installed in pg_catalog. Read its SQL revision from pg_extension in the target database.

14.3 Visibility Fix

Release 14.3.0 corrects columnar stripe xmin visibility. Apply matching library and SQL updates throughout the deployment using extension version 14.3-1; this does not remove the access-method restrictions above.

PG16 Maintenance Release 14.4.1

Citus 14.4.1 aligns the independent citus_columnar SQL version to 14.4-1. The 14.3-to-14.4 transition has no catalog definition changes. Install matching files and use ALTER EXTENSION citus_columnar UPDATE TO '14.4-1'; the storage restrictions above remain. Use the exact SQL revision in the upgrade command; the upstream release number is 14.4.1.

15.0.0 and Existing Databases

15.0.0 uses a buffer access strategy for large columnar scans to reduce pressure on shared buffers.

On PG18, the packaged SQL files provide no in-place path from 14.3-1 to 15.0-1 for either extension. Check the installed revision and the available scripts in each existing database. A null path means the scripts cannot perform this transition.

SELECT path FROM pg_extension_update_paths('citus_columnar')
WHERE source = '14.3-1' AND target = '15.0-1';

Table reader