[go: up one dir, main page]

Skip to content

Postgres sharding with partitioning and FDW

This issues is about hacking on a postgres sharding solution using declarative partitioning and foreign data wrappers (FDW). Using it to put my notes here.

This is a smaller cut of #52 (closed) - to only do the schema changes necessary to setup a single table with two shards.

In this example, I'm taking issues and two local databases serve as shards. We partition issues by HASH(project_id) (for the sake of the example since this is already available). We create 8 partitions and distribute them to 2 shards. The shards are local databases on the same cluster in this example (would later be moved to their own cluster).

Edited by Andreas Brandl