Answer the question
In order to leave comments, you need to log in
The simplest resharding for PostgreSQL?
Good day, colleagues!
There is a PostgreSQL database on one physical server, you need to scatter it over 2 servers. The task is simplified by the fact that there is non-overlapping data (two master tables with their children). Those. ideally, one instance is needed, and the base saw the physical sections of the servers as a tablespace (well, in order, as you might guess, to apply tablespacing).
Usually, horizontal sharding, as I understand it, is solved by the balancer. The simplest one is Postgres-XC. Here, in fact, the question is, can it be done simpler, given the initial data of the problem?
Answer the question
In order to leave comments, you need to log in
Depends on the specific PostgreSQL version.
If it's the simplest one, you can do it from the box in 9.5 via postgres_fdw like this . In <9.5 it is impossible because there external labels (foreign tables) cannot be inherited. Afaik fdw itself is single-threaded for historical reasons, so it makes sense to store several shards at once within one server.
If you need support, and something simpler than vanilla SQL, then it's better to take some kind of ready-made extension (extension) like pg_shard , and then buy their PostgreSQL goodies from them as needed. pg_shard can only perform operations of equality (equality) of hashes of columns in shards, which means that if you crawl out of the borders of the plate with any range query, it will start to plowall the shards, which is pretty annoying. I haven’t noticed the implementation of comparison operations (more/less) of hashes yet, although I haven’t picked it for a long time. Those. although this is a fairly simple solution, without understanding its limitations, it is a little more than certain that you can run into a quasi-lion of a rake. Sometimes it seems that the developers deliberately delay the feature list in order for customers to switch to their paid CitusDB .
Wow.... CitusDB got opensourced today .
PostgreSQL-XC is now a little morally obsolete, and PostgreSQL-XL was developed on its basis , which was already mentioned on Habré. It does not have support as such, but there are a couple of Russian vendors who are constantly tinkering with it, since it is purely open source. IMHO, in terms of functionality, it is much superior to pg_shard , and there are no such stupid problems with it, although it unfolds many times more complicated, not without midnight red-eye.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question