pgEdge
pgEdge is a distributed PostgreSQL distribution for edge scenarios, built on Spock multi-master logical replication.
Overview
In Pigsty, pgEdge is activated via pg_mode: pgedge. The default delivery includes these core components:
pgedge: PG17-compatible kernel (a patched PostgreSQL 17.9)spock: Active-active multi-master logical replicationsnowflake: Distributed unique sequenceslolor: Large object logical replication compatibility layer
pgEdge clusters retain all standard Pigsty capabilities: HA, backup & restore, monitoring & alerting, access control, and IaC configuration management.
Installation
Use the built-in Pigsty template:
./configure -c pgedge
./deploy.yml
After deployment, verify the kernel and extensions:
psql -d meta -c "SELECT version();"
psql -d meta -c "SELECT extname, extversion FROM pg_extension WHERE extname IN ('spock','snowflake','lolor') ORDER BY 1;"
For the full template and parameters, see:
pgedgeconfig template.
Configuration
Key parameters for pgedge mode (matching conf/pgedge.yml):
pg_mode: pgedge
pg_version: 17
pg_packages: [ pgedge, pgsql-common ]
pg_extensions: [ spock, snowflake, lolor ]
pg_libs: 'spock, lolor, pg_stat_statements, auto_explain'
For multi-node multi-master setups, explicitly configure snowflake.node (unique per node):
pg_parameters:
'snowflake.node': 1
The pgEdge docs recommend Spock-specific logical replication parameters (wal_level=logical, sufficient max_wal_senders/max_replication_slots). Pigsty’s oltp/olap/tiny/crit tuning templates already cover these baseline parameters.
Usage
The typical workflow in Pigsty is: validate the kernel on a single node first, then expand into a multi-node Spock replication topology.
1. Enable Extensions
CREATE EXTENSION IF NOT EXISTS spock;
CREATE EXTENSION IF NOT EXISTS snowflake;
CREATE EXTENSION IF NOT EXISTS lolor;
2. Configure Spock Multi-Master Replication
Use the Spock SQL API (node_create, sub_create, etc.) or the pgEdge CLI for node and subscription management. Official entry points:
3. Use Snowflake Sequences (Recommended)
pgEdge strongly recommends Snowflake sequences over traditional sequences for distributed multi-master scenarios. Existing sequences can be converted to Snowflake sequences using Spock/Snowflake tooling.
Notes
Per the pgEdge official limitations, evaluate the following before production use:
- Spock configuration and management typically requires superuser privileges.
UNLOGGEDandTEMPORARYtables are not replicated.- Replication is configured per-database, not instance-wide.
- Replicated tables should have a
PRIMARY KEYor a validREPLICA IDENTITY. - For cross-region multi-master setups, use
snowflakefor sequence management. - If your workload depends on large object replication, use
lolor; native large object logical replication has known limitations.
See the official limitations doc: Spock Limitations.
Related Docs
- PGSQL Kernel Overview
pgedgeconfig template- PGSQL kernel mode config
- pgEdge official docs
- pgEdge Platform Release Notes
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.