# Can we do streaming and logical replication in postgresql Slave at same time?

**URL:** <https://forums.percona.com/t/can-we-do-streaming-and-logical-replication-in-postgresql-slave-at-same-time/19735>\
**Category:** PostgreSQL\
**Created:** [January 23, 2023, 2:15pm UTC](https://forums.percona.com/t/can-we-do-streaming-and-logical-replication-in-postgresql-slave-at-same-time/19735 "2023-01-23T14:15:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankur\_c](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ankur_c/32/9073_2.png) [@Ankur\_c](https://forums.percona.com/u/Ankur_c)\
**Post date:** [January 23, 2023, 2:15pm UTC](https://forums.percona.com/t/can-we-do-streaming-and-logical-replication-in-postgresql-slave-at-same-time/19735/1 "2023-01-23T14:15:43Z")

</div>

We have PostgresSQL cluster with 1 master and 2 slave configuration , we want to enable logical replication from Slave , as the master a pretty work heavy database , we don’t want to put more load on DB , Is it possible if we can start both type of replication from any slave currently replicating through streaming replication

---

<div class="post-metadata">

**Author:** ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)\
**Post date:** [January 23, 2023, 5:55pm UTC](https://forums.percona.com/t/can-we-do-streaming-and-logical-replication-in-postgresql-slave-at-same-time/19735/2 "2023-01-23T17:55:42Z")

</div>

Hi,

Bad news/Good news

Bad News: Unfortunately, postgres doesn’t currently support logical replication from a REPLICA/SLAVE.

Good News: Set up another read-write server and pull in the data you need from the REPLICA using the postgres foreign data wrapper.

Abbreviated example snippet, execute on pg3 (_it’s not really complete, just shows the essentials_):

```auto
begin;
create extension postgres_fdw;
create server pg_remote foreign data wrapper postgres_fdw options (host 'pg2', dbname 'db01', port '5432');
create user mapping for CURRENT_ROLE server pg_remote options (user 'postgres', password 'postgres');
create foreign table public.t1(id integer) server pg_remote;
commit;

```

Of course you’ll need to add supplementary SQL in order to keep your tables uptodate i.e. perhaps an UPSERT.

Hope this helps.
