Databases 22 min read

How Pigsty Turns PostgreSQL into a Cost‑Effective Open‑Source RDS Alternative

Pigsty is an open‑source platform that upgrades PostgreSQL across six dimensions—observability, reliability, availability, maintainability, extensibility, and interoperability—delivering enterprise‑grade features, built‑in monitoring, automatic failover, backup, and performance tuning while cutting cloud database costs dramatically.

ITPUB
ITPUB
ITPUB
How Pigsty Turns PostgreSQL into a Cost‑Effective Open‑Source RDS Alternative

Introduction

The talk introduces Pigsty, an open‑source replacement for commercial cloud RDS services built on PostgreSQL, and explains why cloud‑hosted databases are often far more expensive than self‑managed solutions.

Why Cloud Databases Are Expensive

Public‑cloud database instances can cost 5%–30% of total cloud spend, with price multipliers of 2–3× for Alibaba Cloud RDS and up to ten‑fold for AWS RDS compared to equivalent on‑premise hardware.

Pigsty Overview

Pigsty (Postgres in Great STYle) packages PostgreSQL with best‑practice configurations and adds a suite of services to provide a full‑stack, production‑grade database platform. It can be deployed with a single command and runs on any infrastructure.

Six Core Dimensions

Observability : Integrated Prometheus, Grafana, Loki, Alertmanager, and a custom PG Exporter collect thousands of metrics and present them in dozens of dashboards.

Reliability : Uses Patroni and Etcd for automatic failover and self‑healing; supports WAL archiving and point‑in‑time recovery (PITR) with MinIO/S3 storage.

Availability : Provides DNS/VIP/HAProxy load balancing, read/write splitting, and seamless service switching without DBA intervention.

Maintainability : Offers Database‑as‑Code via declarative Ansible playbooks; users can create databases, users, extensions, and configuration changes with a single yaml file.

Extensibility : Bundles major PostgreSQL extensions (PostGIS, TimescaleDB, Citus) and supports Docker templates for additional plugins such as EdgeDB, FerretDB, Supabase, etc.

Interoperability : Integrates Etcd, MinIO, Redis, Greenplum, and plans to add Kafka and MySQL; provides ready‑to‑run stacks for GitLab, Jira, Odoo, and more.

Observability Details

Pigsty ships a complete monitoring stack: Prometheus scrapes over a thousand PostgreSQL metrics, Grafana visualises them, and Alertmanager handles alerts. The custom PG Exporter gathers all native PostgreSQL metrics, turning them into actionable insights.

Reliability Details

Patroni + Etcd provide automatic leader election and failover. Hardware failures are isolated to a single node, with the cluster continuing to serve reads and writes after a brief (<30 s) disruption.

Availability Details

HAProxy exposes a single VIP; port 5433 handles read/write traffic, while port 5434 provides read‑only access to replicas. Users can define custom services (e.g., standby, ETL) without changing client configuration.

Maintainability Details

All database objects (databases, users, extensions) are managed declaratively. A simple yaml file can add an extension or change a password, and a single ansible-playbook applies the changes.

Extensibility Details

Beyond core extensions, Pigsty supports Docker templates for PostGIS, TimescaleDB, Citus, EdgeDB, FerretDB, Supabase, and many others, turning PostgreSQL into a truly universal data engine.

Interoperability Details

Pigsty also deploys Etcd as a distributed configuration store, MinIO as an S3‑compatible object store for backups, and high‑availability Redis. Future plans include Kafka and MySQL integrations.

Performance

Benchmarks on a 96‑core machine show PostgreSQL can sustain up to 200 k QPS for point selects and 70 k QPS for writes. In cloud tests (AWS C5D), PostgreSQL outperforms many NewSQL solutions, delivering tens of millions of operations per second on modern hardware.

Cost

Using Pigsty for a 13 000‑core PostgreSQL cluster costs roughly ¥500 k per year, compared with ¥1.5 billion in Oracle licensing or tens of millions on public‑cloud RDS. Pigsty therefore rewrites the cost model, delivering enterprise‑grade RDS functionality at a fraction of the price.

Conclusion

Pigsty demonstrates that a well‑engineered, open‑source stack can provide the same reliability, observability, and performance as commercial cloud databases while dramatically reducing cost, making PostgreSQL more accessible to enterprises in China and beyond.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

performanceObservabilityhigh availabilityCost Optimizationopen sourcePostgreSQLRDS Alternative
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.