redis_fdw
redis_fdw
redis_fdw : Foreign data wrapper for querying a Redis server
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8710 | redis_fdw
|
redis_fdw
|
1.0 |
FDW
|
PostgreSQL
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | mongo_fdw
redis
kafka_fdw
wrappers
multicorn
spat
pgmemcache
odbc_fdw
|
multiple branch for different pg major versions
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
1.0 |
18
17
16
15
14
|
redis_fdw |
- |
| RPM | PIGSTY
|
1.0 |
18
17
16
15
14
|
redis_fdw_$v |
- |
| DEB | PIGSTY
|
1.0 |
18
17
16
15
14
|
postgresql-$v-redis-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el8.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el9.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el9.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el10.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
el10.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d12.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d12.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d13.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
d13.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u22.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u22.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u24.x86_64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
u24.aarch64
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
PIGSTY 1.0
|
Source
pig build pkg redis_fdw; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install redis_fdw; # install via package name, for the active PG version
pig install redis_fdw -v 18; # install for PG 18
pig install redis_fdw -v 17; # install for PG 17
pig install redis_fdw -v 16; # install for PG 16
pig install redis_fdw -v 15; # install for PG 15
pig install redis_fdw -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION redis_fdw;Usage
Create Server
CREATE EXTENSION redis_fdw;
CREATE SERVER redis_server FOREIGN DATA WRAPPER redis_fdw
OPTIONS (address '127.0.0.1', port '6379');Server Options: address (default 127.0.0.1), port (default 6379).
Create User Mapping
CREATE USER MAPPING FOR pguser SERVER redis_server
OPTIONS (password 'secret');Scalar Key-Value Pairs
CREATE FOREIGN TABLE redis_db0 (
key text,
val text
)
SERVER redis_server
OPTIONS (database '0');
SELECT * FROM redis_db0;Hash Tables (with Key Prefix)
CREATE FOREIGN TABLE redis_hash (
key text,
val text[]
)
SERVER redis_server
OPTIONS (database '0', tabletype 'hash', tablekeyprefix 'mytable:');
INSERT INTO redis_hash VALUES ('mytable:r1', '{prop1,val1,prop2,val2}');
UPDATE redis_hash SET val = '{prop3,val3}' WHERE key = 'mytable:r1';
DELETE FROM redis_hash WHERE key = 'mytable:r1';
SELECT * FROM redis_hash;Hash Tables (Singleton Key)
CREATE FOREIGN TABLE redis_singleton (
key text,
val text
)
SERVER redis_server
OPTIONS (database '0', tabletype 'hash', singleton_key 'myhash');
INSERT INTO redis_singleton VALUES ('field1', 'value1');
UPDATE redis_singleton SET val = 'newvalue' WHERE key = 'field1';
DELETE FROM redis_singleton WHERE key = 'field1';Table Options
| Option | Description |
|---|---|
database |
Redis database number (default 0) |
tabletype |
hash, list, set, or zset (omit for scalar key-value) |
tablekeyprefix |
Filter items by key prefix |
tablekeyset |
Fetch keys from a specific Redis set |
singleton_key |
Access all values from a single Redis key |
Use only one of tablekeyset or tablekeyprefix. Do not combine them with singleton_key.
Hash values are returned as alternating key-value pairs in a text[] array. Lists, sets, and sorted sets also return values as arrays.
Last updated on