storage_engine
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
storage_engine | 2.4.0 | OLAP | AGPL-3.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2450 | storage_engine | No | Yes | Yes | Yes | No | No | engine |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.4.0 | 1817161514 | storage_engine | - |
| RPM | PIGSTY | 2.4.0 | 1817161514 | storage_engine_$v | - |
| DEB | PIGSTY | 2.4.0 | 1817161514 | postgresql-$v-storage-engine | - |
Build
You can build the RPM / DEB packages for storage_engine using pig build:
Install
You can install storage_engine directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources: README v2.4.0, release v2.4.0, PGXN 2.4.0, current README
storage_engine 2.4.0 provides two PostgreSQL table access methods in the engine schema:
colcompressfor column-oriented compressed storage with vectorized filtering, vectorized aggregation, parallel scans, and stripe/chunk min/max pruning.rowcompressfor row-batch compression with parallel scans, index scans, and batch metadata.
Quick Start
Create tables using either access method. Version 2.2 and later accept per-table options directly in CREATE TABLE ... WITH (...).
Version 2.4 keeps the 2.3 vectorized-aggregation work and adds planner-hook improvements for TPC-H Q7/Q18/Q20/Q21 plus Q9-style post-join aggregates. It also adds backend-local reread caches for repeated rowcompress index probes and repeated colcompress scans.
Main Tuning Knobs
Session-level GUCs documented upstream include:
storage_engine.compressionstorage_engine.compression_levelstorage_engine.stripe_row_limitstorage_engine.chunk_group_row_limitstorage_engine.enable_parallel_executionstorage_engine.min_parallel_processesstorage_engine.enable_vectorizationstorage_engine.enable_vectorized_groupaggstorage_engine.enable_automatic_planstorage_engine.enable_dmlstorage_engine.enable_custom_scanstorage_engine.enable_qual_pushdownstorage_engine.qual_pushdown_correlation_thresholdstorage_engine.max_custom_scan_pathsstorage_engine.enable_engine_index_scanstorage_engine.enable_column_cachestorage_engine.column_cache_sizestorage_engine.debug_vectorized_groupagg_fallbackstorage_engine.planner_debug_levelstorage_engine.maintenance_auto_enabledstorage_engine.maintenance_auto_naptimestorage_engine.maintenance_auto_database
The README says these GUCs become visible once the shared library is loaded; add storage_engine to shared_preload_libraries if you want them available immediately in every session or need the built-in maintenance background worker.
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. The vectorized planner can dispatch engine.vmin, engine.vmax, and engine.vsum on colcompress tables.
Useful Management Functions
For colcompress tables:
Use engine.colcompress_merge() after bulk loads when the orderby key should be globally sorted for pruning. Use CALL engine.colcompress_repack() to compact low-fill stripes, and CALL engine.colcompress_merge_incremental() for lower-lock maintenance that processes dirty stripes in batches.
For rowcompress tables:
Operational views include engine.colcompress_options, engine.colcompress_stripes, engine.rowcompress_options, engine.rowcompress_batches, and engine.storage_health. engine.storage_maintenance_recommendation(table) returns health metrics and a recommended action for one table, and CALL engine.storage_maintenance_auto(...) can dispatch maintenance manually or through the built-in background worker. In v2.4, repeated rowcompress probes can reuse backend-local metadata and decompressed batches, and engine.rowcompress_scan_stats() reports those cache effects more reliably.
When to Use Which AM
- Use
colcompressfor analytical scans, aggregates, and range predicates where projection, vectorization, and stripe/chunk pruning pay off. - Use
rowcompressfor append-heavy logs or wide rows that are usually fetched together, where compression matters more than column projection. - For point lookups on
colcompress, use per-tableindex_scan => trueor session-levelstorage_engine.enable_engine_index_scan = on; for analytical range scans, preferindex_scan => falsewithengine.colcompress_merge()and anorderbykey.
Caveats
- The packaged version in this repo is
2.4.0for PostgreSQL 15 through 18. Upstream v2.4 validation also covers PostgreSQL 19 devel, but PG19 is not in this repo’s package matrix. PostgreSQL 12, 13, and 14 users should stay on upstream 1.3.4. - This stub follows
extension.csvand the v2.4.0 release/PGXN docs. - Upgrade existing installations with
ALTER EXTENSION storage_engine UPDATE TO '2.4.0';. colcompressandrowcompressdo not support foreign keys orAFTER ROWtriggers.pg_repackcannot be used on these table access methods.engine.colcompress_repack()acquiresAccessExclusiveLock, so schedule it during maintenance windows for large tables; the incremental merge procedures are the lower-lock option for dirty stripes or batches.VACUUM FULL,CLUSTER, andCREATE UNLOGGED TABLE ... USING colcompressare not supported; upstream recommends the extension’s merge/repack functions instead.- On
colcompress, combiningorderbywith B-tree indexes can disable the sort-on-write path, and B-tree indexes on ordered columns can defeat stripe pruning for range queries. Useengine.colcompress_merge()after loading data when global ordering matters, and preferindex_scan => falsefor analytical tables. - If
citusorpg_cronis also preloaded, upstream documents the load order asshared_preload_libraries = 'pg_cron,citus,storage_engine';citusmust appear beforestorage_engine.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)