Skip to content

kv_fdw

Foreign data wrapper for key-value storage backed by RocksDB/VidarDB.

kv_fdw · Foreign data wrapper for key-value storage backed by RocksDB/VidarDB.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100103kv_fdwkv_fdw0.0.1FDWApache-2.0C++

PostgreSQL · 13

Usage

Sources:

kv_fdw embeds RocksDB behind a PostgreSQL foreign table, avoiding a separate remote database server. It supports basic reads and writes, but the upstream project describes version 0.0.1 as PostgreSQL 13-only and not product-ready.

Core Workflow

Install a compatible RocksDB library, add kv_fdw to shared_preload_libraries, and restart PostgreSQL before creating the extension and server.

CREATE EXTENSION kv_fdw;
CREATE SERVER kv_server FOREIGN DATA WRAPPER kv_fdw;
CREATE FOREIGN TABLE student (
    id integer,
    name text
) SERVER kv_server;

INSERT INTO student VALUES (20757123, 'Rafferty');
SELECT * FROM student WHERE id = 20757123;

The first foreign-table attribute is the key. To model a composite key, upstream suggests using a composite PostgreSQL type as that first attribute. The wrapper does not take server options in the documented workflow.

Limitations and Recovery

kv_fdw has no rollback or abort support. Once a foreign table is created, the documented implementation cannot add or drop columns, and it provides no secondary indexes. These constraints make ordinary PostgreSQL transaction expectations unsafe: rehearse failures and crash recovery, avoid mixing critical relational changes with RocksDB writes, and keep an independent backup strategy.

Dropping a foreign table does not imply that its on-disk RocksDB data has been removed. Follow the upstream removal procedure and inspect data_directory deliberately. Pin RocksDB 6.11.4, PostgreSQL 13, and the extension commit used for the reviewed build; ABI or storage-format drift can prevent startup or data access.

Table reader