# Postgresql – Can PostgreSQL slave server act as master for a new database

master-slave-replicationpostgresqlreplication

My question is somewhat related to:
https://stackoverflow.com/questions/19331577/does-postgres-replication-native-support-per-database-level-replication

We have master-slave replication set up on our Postgres server (1 master and 1 slave). We have all our app tables in database DB1.

Our reporting group reads from DB1 and creates tables in a separate database DB2. The queries look like this:

INSERT INTO DB2.<some_table>
(SELECT ... FROM ... DB1 tables ...)


The READ queries that run against DB1 take a long time to run, so ideally we want to run these queries on the slave. But the WRITEs have to go to the master, so we end up running our entire SQL on master now.

Is there a way to make DB2 available only on the slave server and let the slave server be the master for DB2?

The alternative would be to write a script that reads from slave and writes to master, but I would like to avoid that since most people know only SQL.