pgsync
PGSync is a real-time change data capture tool that automatically syncs data from PostgreSQL, MySQL, or MariaDB into Elasticsearch or OpenSearch. You define your document structure in JSON, and the tool handles denormalization, incremental updates, and consistency without requiring custom ETL code.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | toluaina/pgsync |
| Owner | toluaina |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 1.4k |
| Forks | 210 |
| Open issues | 208 |
| Latest release | 7.1.0 (2026-06-25) |
| Last updated | 2026-06-29 |
| Source | https://github.com/toluaina/pgsync |
What pgsync is
PGSync leverages PostgreSQL logical replication (WAL) or MySQL/MariaDB binary logging to detect changes, auto-generates optimized SQL JOINs from schema definitions, and bulk-indexes denormalized documents into Elasticsearch/OpenSearch with checkpoint-based fault tolerance. Python-based, requires Redis for state management (optional in WAL mode).
Get the pgsync source
Clone the repository and explore it locally.
git clone https://github.com/toluaina/pgsync.gitcd pgsync# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- PostgreSQL requires `wal_level=logical` and replication slot configuration; MySQL/MariaDB require binary logging and replication user setup—plan 2–4 hours for database enablement.
- Schema definition in JSON is straightforward but requires careful mapping of parent–child relationships and column selection; test with production schema complexity first.
- Redis is needed for state/checkpoint management (or file-based fallback); plan for Redis HA/sentinel in production to avoid losing sync position.
- Initial full sync of large tables (millions of rows) may take hours; test with production data volumes and tune bulk batch sizes.
- Transforms (replace, rename, concat) are applied at index time; complex business logic may require custom post-processing or Elasticsearch ingest pipelines.
When to avoid it — and what to weigh
- Requires sub-second latency guarantees — PGSync is near real-time but not guaranteed microsecond delivery; network, Redis, and Elasticsearch commit latencies apply. Not suitable for high-frequency trading or hard real-time systems.
- Need to sync multiple databases or complex multi-source workflows — PGSync is single-source CDC; if you need to aggregate data from disparate systems or handle complex ETL workflows, consider Kafka, Debezium, or purpose-built data orchestration platforms.
- Elasticsearch/OpenSearch is not your search engine — PGSync is hardcoded for Elasticsearch/OpenSearch targets. If your search layer is Solr, Algolia, Meilisearch, or in-database full-text search, this tool adds no value.
- Limited DevOps/Kubernetes operational readiness — Project has 208 open issues, recent activity, and MIT license clarity, but unknown production deployment best practices, SLA expectations, and Kubernetes Operator maturity.
License & commercial use
MIT License. Permissive OSI-approved license allowing commercial use, modification, and redistribution with attribution. No copyleft restrictions.
MIT license permits commercial use without restrictions. However, the project is community-maintained; no commercial support, SLA, or warranty is provided by the maintainer. Evaluate your risk tolerance for production use without paid support contracts.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
No exploit details provided. General considerations: PGSync runs as a daemon with database credentials and Elasticsearch auth—store secrets (PG_URL, ELASTICSEARCH_URL) in vault/secrets manager, not environment files. Ensure network policies restrict database and search engine access. MySQL/MariaDB replication user should be scoped to minimal privileges. No third-party security audit data available; review dependencies (psycopg2, pymysql, redis client) for CVEs before production use.
Alternatives to consider
Debezium + Kafka Connect
Enterprise-grade CDC platform with pluggable sinks, higher fault tolerance, multi-database support, and active Confluent backing. Higher operational complexity and resource footprint.
Elasticsearch Connector for Postgres (wal2json-based)
Lower-level WAL-native syncing with fine-grained control; requires more manual pipeline orchestration but avoids Redis dependency. Steeper learning curve.
Custom application-level dual-write + queue
Build on pgsync with DEV.co software developers
Evaluate PGSync for your project or consult with our team on deployment architecture, database prerequisite setup, and scaling strategies for production use.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
pgsync FAQ
Does PGSync require downtime to set up?
What happens if PGSync crashes or network drops?
Can I sync to multiple Elasticsearch clusters simultaneously?
Is PGSync suitable for GDPR/right-to-be-forgotten compliance?
Work with a software development agency
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If pgsync is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.
Ready to sync your database to Elasticsearch?
Evaluate PGSync for your project or consult with our team on deployment architecture, database prerequisite setup, and scaling strategies for production use.