Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 5AFB89FE16B for ; Thu, 14 Jun 2012 15:35:03 -0300 (ADT) Received: from mx2.d2.com ([66.251.81.121]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SfEsi-0001MU-3l for pgsql-admin@postgresql.org; Thu, 14 Jun 2012 18:35:02 +0000 Received: from mxb.d2.com ([10.85.4.6]) by mx2.d2.com (8.13.8/8.13.8) with ESMTP id q5EJUfv3017293 for ; Thu, 14 Jun 2012 12:30:53 -0700 X-ASG-Debug-ID: 1339698861-01d10a738e351e00001-ysJW5H Received: from mail01.d2.com ([172.16.66.171]) by mxb.d2.com with ESMTP id Teox3tUWqAuDcHsP for ; Thu, 14 Jun 2012 11:34:21 -0700 (PDT) X-Barracuda-Envelope-From: aalvarez@d2.com Received: from exbew2k3-02.d2.com (exbew2k3-02 [10.78.2.16]) by mail01.d2.com (8.13.8/8.13.8/Debian-3) with ESMTP id q5EIYLB7018354 for ; Thu, 14 Jun 2012 11:34:21 -0700 Received: from [10.126.2.220] ([10.126.2.220] RDNS failed) by exbew2k3-02.d2.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 14 Jun 2012 11:34:20 -0700 Message-ID: <4FDA2EAC.3010407@d2.com> Date: Thu, 14 Jun 2012 11:34:20 -0700 From: Amador Alvarez User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Merging two databases References: X-ASG-Orig-Subj: Re: [ADMIN] Merging two databases In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Jun 2012 18:34:20.0927 (UTC) FILETIME=[505C10F0:01CD4A5C] X-Barracuda-Connect: UNKNOWN[172.16.66.171] X-Barracuda-Start-Time: 1339698861 X-Barracuda-URL: http://10.85.4.6:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at d2.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.99845 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: NO, score=-1.6 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RATWARE_GECKO_BUILD,SARE_SPEC_REPLICA_OBFU autolearn=no version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on mx2.d2.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/75 X-Sequence-Number: 39666 Hi, Obviously it will always depends on the constraints in your schema, but why do not dump the databases out and import it into a single one properly? Once you get the new database, it should be easy to catch up with the 2 databases before the switching (with statements like insert/update into Newdb tables ...(select from Olddb tables)). It is up to you, this is to avoid replication settings, however using replication could be a good thing for future replication experiences. A.A. On 06/12/2012 03:23 AM, Lukasz Brodziak wrote: > Hi there, > > Is there a way of merging two databases in postgresql in the way of > differential replication? The thing is that we have two DBs with same > schemas and we want to merge the data within them into one single > replica. Are there any tools/ways of doing this? Of course when the > merged db is created it will be only updated/inserted with new data > from each of source DBs. >