Our database writing needs exceed the capacity of a single Postgres cluster (since each cluster can only support 1 writer server).

To combat this, we've sharded our data across 8 separate Postgres clusters, which we call shards. These shards are completely independent Postgres clusters, that just happen to have the same schemas. Our data is such that there is no need for any cross-shard joins, foreign keys, etc. (For example, all records are tied to a customer, and all of a customer's records reside within a single shard, so there's no need to do cross-shard foreign key look ups.)

This approach has been working successfully in production, but there's one hiccup: aAny time that we need to make a change to the schema, we need to manually execute the DDL on every shard. To be clear: we don't need to synchronize the actual records, only schema changes, such as adding a column to a table.

Obviously, such a manual process is error-prone, and it's only a matter of time until our shard's schema start de-synchronizing via an accumulation of small human errors.

Is there an established way to automate this process?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.