pg_fact_loader
build fact tables with Postgres
pg_fact_loader : build fact tables with Postgres
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9820 | pg_fact_loader | pg_fact_loader | 2.0.1 |
ETL | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | fact_loader |
| See Also | file_fdw pg_bulkload pg_parquet aws_s3 pg_lake pg_ducklake pg_csv omni_csv |
PGDG provides the regular DEB channel; Pigsty fills the missing PostgreSQL 18 packages on Debian/Ubuntu and builds PG14-18 for Ubuntu 26.04 (Resolute).
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.0.1 |
18 17 16 15 14 | pg_fact_loader |
- |
| RPM | PGDG | 2.0.1 |
18 17 16 15 14 | pg_fact_loader_$v |
- |
| DEB | PGDG | 2.0.1 |
18 17 16 15 14 | postgresql-$v-pg-fact-loader |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| el8.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| el9.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| el9.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| el10.x86_64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| el10.aarch64 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| d12.x86_64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| d12.aarch64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| d13.x86_64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| d13.aarch64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| u22.x86_64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| u22.aarch64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| u24.x86_64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| u24.aarch64 | PIGSTY 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 | PGDG 2.0.1 |
| u26.x86_64 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 |
| u26.aarch64 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 | PIGSTY 2.0.1 |
Source
github.com/enova/pg_fact_loader
pg_fact_loader-2.0.1.tar.gz
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
Build and maintain fact tables using queue-based change data capture. Processes audit/change log tables to incrementally update fact tables.
Enabling
Optionally with pglogical for replica-based setup:
Workflow
- Replicate source tables to a reporting database (via pglogical or other means)
- Create audit/change log tables on the OLTP system for source tables
- Create a fact table structure for aggregated data
- Create a merge function that takes a key ID and returns one row of the fact table
- Configure pg_fact_loader to wire queue tables to fact tables
- Backfill the fact table initially
- Schedule the worker to process changes continuously
Configuration Tables
Running the Worker
Initial Backfill
Adding Batch ID Fields
Key Features
- Queue-based incremental fact table updates
- Supports insert, update, and delete events
- Handles multi-level key retrieval (joins through multiple tables)
- Fact table dependency chains (child facts updated after parent)
- Checks replication lag before processing (when used with pglogical)