Copy/Replicate subsets of tables from different databases into third database
I have two databases: 1) accounts-management 2) games-management
I want to make reports, which use data from both databases and i want to have third database which is suitable 开发者_JS百科for reporting.
So, how can i copy/replicate/use cron job/etc a subset of tables from 1) db and other subset of tables from 2) db into third db (the reporting db).
I user postgres 9
Thanks.
There are two solutions I see:
- (preferred) create just one database, but with three separate schemas
- use dblink to communicate between multiple databases within main connection
There are several reasons why one might want to use schemas:
- To organize database objects into logical groups to make them more manageable.
Slony can do this. Just make two replication sets, one from db1 to db3, and another from db2 to db3. As long as the table names don't conflict you can have them all in the same schema and database no problem.
精彩评论