YugabyteDB — Distributed SQL That Is Fully PostgreSQL Compatible
YugabyteDB is a distributed SQL database that reuses the PostgreSQL query layer while adding horizontal scale, multi-region replication, and resilience. It is Postgres you can shard across continents.
Instalación lista para agent
Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.
npx -y tokrepo@latest install 09a16401-37d2-11f1-9bc6-00163e2b0d79 --target codexEjecutar después de confirmar el plan con dry-run.
What it is
YugabyteDB is an open-source distributed SQL database that reuses the PostgreSQL query layer -- indexing, extensions, JSONB, stored procedures, triggers -- and places it on top of DocDB, a distributed storage engine forked from RocksDB. The result is a database that behaves exactly like PostgreSQL to your ORM but scales horizontally across zones and regions.
It targets teams running PostgreSQL who have outgrown a single node and need automatic sharding, multi-region replication, and zone-failure resilience without abandoning their existing SQL schemas and tooling.
How it saves time or tokens
Migrating from PostgreSQL to a proprietary distributed database usually means rewriting queries, changing drivers, and learning a new data model. YugabyteDB uses the PostgreSQL wire protocol (YSQL on port 5433), so existing psql commands, pg_dump backups, and ORM configurations work without changes. This eliminates weeks of migration engineering. Automatic sharding removes the manual partition management that PostgreSQL requires at scale.
How to use
- Start a single-node instance with Docker for local development.
docker run -d --name yb \
-p 7000:7000 -p 9000:9000 -p 5433:5433 -p 9042:9042 \
yugabytedb/yugabyte:latest bin/yugabyted start --daemon=false
- Connect using standard psql on port 5433.
psql -h localhost -p 5433 -U yugabyte
- Create tables and run queries exactly as you would in PostgreSQL.
CREATE TABLE orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id BIGINT NOT NULL,
amount DECIMAL(18,2),
created TIMESTAMPTZ DEFAULT now()
);
INSERT INTO orders (user_id, amount) VALUES (1, 99.95), (2, 150.00);
SELECT * FROM orders WHERE amount > 100;
Example
A three-node cluster for testing replication:
# Node 1
bin/yugabyted start --base_dir=/tmp/ybd1 --listen=127.0.0.1
# Node 2
bin/yugabyted start --base_dir=/tmp/ybd2 --listen=127.0.0.2 --join=127.0.0.1
# Node 3
bin/yugabyted start --base_dir=/tmp/ybd3 --listen=127.0.0.3 --join=127.0.0.1
Data is automatically sharded across all three nodes. Kill any one node and reads/writes continue on the remaining two.
Related on TokRepo
- Database tools -- Compare YugabyteDB with other database solutions for AI workloads.
- DevOps tools -- Infrastructure automation that pairs well with distributed databases.
Common pitfalls
- YugabyteDB adds network round-trip latency per query compared to single-node PostgreSQL. For low-latency local workloads, vanilla PostgreSQL is faster.
- Not all PostgreSQL extensions are supported. Check the compatibility matrix before migrating extension-heavy schemas.
- Default Docker setup runs a single node without replication. Use at least three nodes for any testing that involves failover behavior.
Preguntas frecuentes
YugabyteDB reuses the PostgreSQL query layer and supports most PostgreSQL syntax, data types, indexing, JSONB, stored procedures, and triggers. Some extensions and advanced features have compatibility gaps. The project maintains a compatibility tracker in its documentation.
YugabyteDB automatically shards data across nodes using hash or range partitioning on the primary key. You do not need to manually define partitions. The system rebalances shards when nodes are added or removed.
Yes. YugabyteDB speaks the PostgreSQL wire protocol on port 5433. Standard drivers for Python (psycopg2), Java (JDBC), Go (pgx), and Node.js (pg) work without modification. ORMs like Django, SQLAlchemy, and GORM connect the same way.
YSQL is the PostgreSQL-compatible SQL API on port 5433. YCQL is a Cassandra-compatible API on port 9042 for wide-column workloads. Most new projects use YSQL for its richer SQL feature set.
Both are distributed SQL databases. YugabyteDB reuses the actual PostgreSQL query layer for higher compatibility, while CockroachDB implements its own SQL engine. YugabyteDB also offers a Cassandra-compatible API (YCQL). Performance and licensing terms differ, so benchmarking your specific workload is recommended.
Referencias (3)
- YugabyteDB GitHub— YugabyteDB reuses the PostgreSQL query layer on DocDB storage engine
- YugabyteDB Docs— YSQL provides PostgreSQL wire protocol compatibility
- YugabyteDB Architecture Docs— DocDB is built on a fork of RocksDB
Relacionados en TokRepo
Discusión
Activos relacionados
SQLx — Compile-Time Checked SQL for Rust
SQLx is an async, pure-Rust SQL crate that checks queries against your database at compile time. It supports PostgreSQL, MySQL, MariaDB, and SQLite without a DSL or ORM layer.
Beekeeper Studio — Modern SQL Editor and Database Manager
Beekeeper Studio is a free, open-source SQL editor and database management GUI. It connects to MySQL, PostgreSQL, SQLite, SQL Server, CockroachDB, and more with a clean modern interface.
KeeWeb — Free Cross-Platform Password Manager Compatible with KeePass
KeeWeb is a free, open-source password manager that runs in the browser or as a desktop app. It is fully compatible with KeePass kdbx database files and requires no server, storing your encrypted vault locally or syncing via Dropbox, Google Drive, or WebDAV.
Apache AGE — Graph Database Extension for PostgreSQL
Apache AGE (A Graph Extension) adds graph database capabilities to PostgreSQL. Query your existing Postgres data as a graph using openCypher while keeping full SQL compatibility.