router
router · Experimental C extension that routes PostgreSQL OLTP queries across shards.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100316 | router | router | 0.0.1 | OLAP | PostgreSQL | C |
Usage
Sources:
- Official README at the reviewed commit
- Version 0.0.1 SQL API
- Shard metadata implementation
- Planner-hook implementation
- Extension control file
router is an unfinished proof-of-concept request router for OLTP sharding. The canonical extension name is router, although stale comments in its SQL file say mdb_router. Its planner hook and in-memory metadata code are unsafe for production data or credentials; evaluate only in a disposable, isolated lab.
Intended Interface
The SQL surface includes mdbr_add_shard, mdbr_reset_meta, create_sharding_key, assign_key_range_2_shard, show_shkey, and add_local_table. A minimal lab setup illustrates the intended model:
The upstream demonstration uses preload-oriented startup and a make-driven cluster harness; creating SQL objects alone does not establish a supported operating procedure. Metadata is kept in shared structures and is not durably coordinated or restored after restart.
Critical Safety Boundaries
Shard hosts, users, and plaintext passwords are copied into fixed-size shared-memory buffers with unbounded string operations. Oversized input can corrupt memory, and debug logging can disclose connection parameters including the password. Never provide real credentials or expose the metadata functions to untrusted callers.
The code has small fixed limits for shards, sharding keys, columns, and key ranges, alongside unfinished and version-copied planner paths. The README itself lists bad memory management and missing metadata consistency. No transaction, failover, restart-recovery, schema-change, or routing-correctness guarantees can be inferred. Use router only to inspect historical design ideas, never as a production sharding layer.