Thread: Logical replication to partitioned subscriber

Logical replication to partitioned subscriber

From
Jeremy Finzel
Date:
Are there any plans to support logical replication to a table which is only partitioned on the subscriber?  We are very interested in such a feature for a couple use cases.  We are using logical replication for archiving data and we only want it partitioned on the archive server, and we want it to just work transparently with logical replication.

Another use case is to convert a huge OLTP database table to be partitioned, and as opposed to writing a script, use logical replication to replicate to a destination replica which has the partitioning work done online, then swap nodes.

We are using pglogical, but I see from the docs that the same limitations apply even in pg11's built-in logical replication.

Thanks!
Jeremy

Re: Logical replication to partitioned subscriber

From
Alvaro Herrera
Date:
On 2018-Sep-14, Jeremy Finzel wrote:

> Are there any plans to support logical replication to a table which is only
> partitioned on the subscriber?  We are very interested in such a feature
> for a couple use cases.  We are using logical replication for archiving
> data and we only want it partitioned on the archive server, and we want it
> to just work transparently with logical replication.
> 
> Another use case is to convert a huge OLTP database table to be
> partitioned, and as opposed to writing a script, use logical replication to
> replicate to a destination replica which has the partitioning work done
> online, then swap nodes.
> 
> We are using pglogical, but I see from the docs that the same limitations
> apply even in pg11's built-in logical replication.

As I understand, in pglogical you can set pglogical.use_spi and it
Should Work(tm).

As for built-in replication, I'm afraid there's a small patch required
to make it work, and nobody wrote it for pg11.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services