Skip to content

pg_accumulator

Accumulation registers for balance and turnover tracking in PostgreSQL

pg_accumulator · Accumulation registers for balance and turnover tracking in PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4845pg_accumulatorpg_accumulator1.2.0FUNCPostgreSQLC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono
Relationships
Schemasaccum
Requiresplpgsql
See Alsocurrency financial omni_ledger

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.2.019 18 17 16 15pg_accumulatorplpgsql
RPMPIGSTY1.2.019 18 17 16 15pg_accumulator_$v-
DEBPIGSTY1.2.019 18 17 16 15postgresql-$v-pg-accumulator-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el8.aarch64N/APIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el9.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el9.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el10.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el10.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
d12.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
d12.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
d13.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
d13.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u22.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u22.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u24.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u24.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u26.x86_64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
u26.aarch64PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
PackageVersionOSORGSIZEFile URL
pg_accumulator_191.2.0el9.x86_64pigsty72.9 KiBpg_accumulator_19-1.2.0-1PGSTY.el9.x86_64.rpm
pg_accumulator_191.2.0el9.aarch64pigsty72.5 KiBpg_accumulator_19-1.2.0-1PGSTY.el9.aarch64.rpm
pg_accumulator_191.2.0el10.x86_64pigsty73.2 KiBpg_accumulator_19-1.2.0-1PGSTY.el10.x86_64.rpm
pg_accumulator_191.2.0el10.aarch64pigsty72.9 KiBpg_accumulator_19-1.2.0-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-accumulator1.2.0d12.x86_64pigsty54.9 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-accumulator1.2.0d12.aarch64pigsty54.8 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-accumulator1.2.0d13.x86_64pigsty55.0 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~trixie_amd64.deb
postgresql-19-pg-accumulator1.2.0d13.aarch64pigsty54.8 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~trixie_arm64.deb
postgresql-19-pg-accumulator1.2.0u22.x86_64pigsty56.4 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~jammy_amd64.deb
postgresql-19-pg-accumulator1.2.0u22.aarch64pigsty56.3 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~jammy_arm64.deb
postgresql-19-pg-accumulator1.2.0u24.x86_64pigsty56.2 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~noble_amd64.deb
postgresql-19-pg-accumulator1.2.0u24.aarch64pigsty55.9 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~noble_arm64.deb
postgresql-19-pg-accumulator1.2.0u26.x86_64pigsty56.0 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~resolute_amd64.deb
postgresql-19-pg-accumulator1.2.0u26.aarch64pigsty55.8 KiBpostgresql-19-pg-accumulator_1.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_accumulator_181.2.0el8.x86_64pigsty75.1 KiBpg_accumulator_18-1.2.0-1PGSTY.el8.x86_64.rpm
pg_accumulator_181.2.0el8.aarch64pigsty74.8 KiBpg_accumulator_18-1.2.0-1PGSTY.el8.aarch64.rpm
pg_accumulator_181.2.0el9.x86_64pigsty73.2 KiBpg_accumulator_18-1.2.0-1PGSTY.el9.x86_64.rpm
pg_accumulator_181.2.0el9.aarch64pigsty72.4 KiBpg_accumulator_18-1.2.0-1PGSTY.el9.aarch64.rpm
pg_accumulator_181.2.0el10.x86_64pigsty73.3 KiBpg_accumulator_18-1.2.0-1PGSTY.el10.x86_64.rpm
pg_accumulator_181.2.0el10.aarch64pigsty72.9 KiBpg_accumulator_18-1.2.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-accumulator1.2.0d12.x86_64pigsty54.9 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-accumulator1.2.0d12.aarch64pigsty54.6 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-accumulator1.2.0d13.x86_64pigsty54.9 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-accumulator1.2.0d13.aarch64pigsty54.7 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-accumulator1.2.0u22.x86_64pigsty56.5 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-accumulator1.2.0u22.aarch64pigsty56.3 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-accumulator1.2.0u24.x86_64pigsty56.0 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-accumulator1.2.0u24.aarch64pigsty55.7 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-accumulator1.2.0u26.x86_64pigsty56.1 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-accumulator1.2.0u26.aarch64pigsty55.8 KiBpostgresql-18-pg-accumulator_1.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_accumulator_171.2.0el8.x86_64pigsty75.1 KiBpg_accumulator_17-1.2.0-1PGSTY.el8.x86_64.rpm
pg_accumulator_171.2.0el8.aarch64pigsty74.8 KiBpg_accumulator_17-1.2.0-1PGSTY.el8.aarch64.rpm
pg_accumulator_171.2.0el9.x86_64pigsty73.2 KiBpg_accumulator_17-1.2.0-1PGSTY.el9.x86_64.rpm
pg_accumulator_171.2.0el9.aarch64pigsty72.3 KiBpg_accumulator_17-1.2.0-1PGSTY.el9.aarch64.rpm
pg_accumulator_171.2.0el10.x86_64pigsty73.3 KiBpg_accumulator_17-1.2.0-1PGSTY.el10.x86_64.rpm
pg_accumulator_171.2.0el10.aarch64pigsty72.8 KiBpg_accumulator_17-1.2.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-accumulator1.2.0d12.x86_64pigsty54.8 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-accumulator1.2.0d12.aarch64pigsty54.6 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-accumulator1.2.0d13.x86_64pigsty54.8 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-accumulator1.2.0d13.aarch64pigsty54.7 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-accumulator1.2.0u22.x86_64pigsty57.8 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-accumulator1.2.0u22.aarch64pigsty57.5 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-accumulator1.2.0u24.x86_64pigsty56.0 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-accumulator1.2.0u24.aarch64pigsty55.7 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-accumulator1.2.0u26.x86_64pigsty56.1 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-accumulator1.2.0u26.aarch64pigsty55.8 KiBpostgresql-17-pg-accumulator_1.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_accumulator_161.2.0el8.x86_64pigsty75.1 KiBpg_accumulator_16-1.2.0-1PGSTY.el8.x86_64.rpm
pg_accumulator_161.2.0el8.aarch64pigsty74.7 KiBpg_accumulator_16-1.2.0-1PGSTY.el8.aarch64.rpm
pg_accumulator_161.2.0el9.x86_64pigsty73.2 KiBpg_accumulator_16-1.2.0-1PGSTY.el9.x86_64.rpm
pg_accumulator_161.2.0el9.aarch64pigsty72.3 KiBpg_accumulator_16-1.2.0-1PGSTY.el9.aarch64.rpm
pg_accumulator_161.2.0el10.x86_64pigsty73.3 KiBpg_accumulator_16-1.2.0-1PGSTY.el10.x86_64.rpm
pg_accumulator_161.2.0el10.aarch64pigsty72.8 KiBpg_accumulator_16-1.2.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-accumulator1.2.0d12.x86_64pigsty54.8 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-accumulator1.2.0d12.aarch64pigsty54.6 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-accumulator1.2.0d13.x86_64pigsty54.8 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-accumulator1.2.0d13.aarch64pigsty54.7 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-accumulator1.2.0u22.x86_64pigsty57.8 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-accumulator1.2.0u22.aarch64pigsty57.5 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-accumulator1.2.0u24.x86_64pigsty56.0 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-accumulator1.2.0u24.aarch64pigsty55.7 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-accumulator1.2.0u26.x86_64pigsty56.1 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-accumulator1.2.0u26.aarch64pigsty55.8 KiBpostgresql-16-pg-accumulator_1.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_accumulator_151.2.0el8.x86_64pigsty75.2 KiBpg_accumulator_15-1.2.0-1PGSTY.el8.x86_64.rpm
pg_accumulator_151.2.0el8.aarch64pigsty74.8 KiBpg_accumulator_15-1.2.0-1PGSTY.el8.aarch64.rpm
pg_accumulator_151.2.0el9.x86_64pigsty73.2 KiBpg_accumulator_15-1.2.0-1PGSTY.el9.x86_64.rpm
pg_accumulator_151.2.0el9.aarch64pigsty72.5 KiBpg_accumulator_15-1.2.0-1PGSTY.el9.aarch64.rpm
pg_accumulator_151.2.0el10.x86_64pigsty73.4 KiBpg_accumulator_15-1.2.0-1PGSTY.el10.x86_64.rpm
pg_accumulator_151.2.0el10.aarch64pigsty73.0 KiBpg_accumulator_15-1.2.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-accumulator1.2.0d12.x86_64pigsty54.9 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-accumulator1.2.0d12.aarch64pigsty54.6 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-accumulator1.2.0d13.x86_64pigsty54.9 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~trixie_amd64.deb
postgresql-15-pg-accumulator1.2.0d13.aarch64pigsty54.7 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~trixie_arm64.deb
postgresql-15-pg-accumulator1.2.0u22.x86_64pigsty57.9 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~jammy_amd64.deb
postgresql-15-pg-accumulator1.2.0u22.aarch64pigsty57.7 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~jammy_arm64.deb
postgresql-15-pg-accumulator1.2.0u24.x86_64pigsty56.2 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~noble_amd64.deb
postgresql-15-pg-accumulator1.2.0u24.aarch64pigsty55.8 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~noble_arm64.deb
postgresql-15-pg-accumulator1.2.0u26.x86_64pigsty56.2 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~resolute_amd64.deb
postgresql-15-pg-accumulator1.2.0u26.aarch64pigsty56.0 KiBpostgresql-15-pg-accumulator_1.2.0-1PGSTY~resolute_arm64.deb

Source

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

pig install pg_accumulator -v 19;   # install for PG 19
pig install pg_accumulator -v 18;   # install for PG 18
pig install pg_accumulator -v 17;   # install for PG 17
pig install pg_accumulator -v 16;   # install for PG 16
pig install pg_accumulator -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pg_accumulator CASCADE; -- requires plpgsql

Usage

Sources: README, documentation, control file

pg_accumulator implements declarative accumulation registers for PostgreSQL. A register records movements across arbitrary dimensions and resources, then exposes generated functions for balances, turnovers, movement history, verification, and rebuild operations.

Enable

CREATE EXTENSION pg_accumulator;

For high-write workloads that use the delta buffer and background worker, preload the library and restart PostgreSQL:

shared_preload_libraries = 'pg_accumulator'

Create A Register

SELECT accum.register_create(
  name := 'inventory',
  dimensions := '{"warehouse": "int", "product": "int"}',
  resources := '{"quantity": "numeric", "amount": "numeric"}',
  kind := 'balance'
);

The call creates the register metadata, movement table, total tables, balance cache, triggers, generated query functions, and supporting indexes.

Post And Query Movements

SELECT accum.register_post('inventory', '{
  "period": "2026-04-01",
  "document": "receipt:1",
  "dimensions": {"warehouse": 1, "product": 42},
  "resources": {"quantity": 10, "amount": 250}
}');

SELECT * FROM accum.inventory_balance(
  dimensions := '{"warehouse": 1, "product": 42}'
);

SELECT * FROM accum.inventory_turnover(
  from_date := '2026-04-01',
  to_date := '2026-04-30',
  dimensions := '{"warehouse": 1}',
  group_by := '["product"]'
);

Corrections And Maintenance

Use register_unpost and register_repost for retroactive corrections. Use register_verify, register_rebuild_totals, and register_rebuild_cache to check and repair derived state when needed.

SELECT accum.register_unpost('inventory', 'receipt:1');
SELECT accum.register_verify('inventory');

Configuration

The documented GUCs include pg_accumulator.background_workers, pg_accumulator.delta_merge_interval, pg_accumulator.delta_merge_delay, pg_accumulator.delta_merge_batch_size, pg_accumulator.partitions_ahead, and pg_accumulator.maintenance_interval.

Table reader