PostgresSQL: Sharding on top of partitioning; based on Foreign Data Wrapper (FDW) support.
-- create a partition on remote server
CREATE TABLE temperature_201904 (
id BIGSERIAL NOT NULL,
city_id INT NOT NULL,
timestamp TIMESTAMP NOT NULL,
temp DECIMAL(5,2) NOT NULL
);
-- load the postgres_fdw extension
CREATE EXTENSION postgres_fdw;
GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw to app_user;
-- local user access the remote server
CREATE SERVER shard02 FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (dbname 'postgres', host 'shard02', port
'5432');
-- mapp user with a user in the remote server
CREATE USER MAPPING for app_user SERVER shard02
OPTIONS (user 'fdw_user', password 'secret');
-- local server linked to the table of the same name in remote server
CREATE FOREIGN TABLE temperature_201904 PARTITION OF temperature
FOR VALUES FROM ('2019-04-01') TO ('2019-05-01')
SERVER remoteserver01;
CRDB sharding: hash-sharding
Hash-sharded Indexes | CockroachDB Docs (cockroachlabs.com)
CREATE TABLE | CockroachDB Docs (cockroachlabs.com)
parallel support, horizontal sharding and locality
set up cloudlab
implement client.h