Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMQYn-00065P-Dr for pgsql-general@arkaria.postgresql.org; Sat, 26 May 2018 04:12:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fMQYm-0003Ro-0q for pgsql-general@arkaria.postgresql.org; Sat, 26 May 2018 04:12:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMQYk-0003Rd-QR for pgsql-general@lists.postgresql.org; Sat, 26 May 2018 04:12:03 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fMQYX-0002Jf-Ga for pgsql-general@postgresql.org; Sat, 26 May 2018 04:12:02 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9472421841; Sat, 26 May 2018 00:11:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 26 May 2018 00:11:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=xxn161WyWUMlJN+yGcWcoKSI76pGb gSkyutn0BKb50I=; b=dvV8UVh614hHp3NcFGrSPB/8oZ32TAXg5YYBklFsx80IA OygXO3uxWOjD5USdoZTOF99Mdo0P0kyCiJJU/pVLRwDN5dmd5sIHjrdBY5ey4OjY kadOGZ/rlpG+pWEaxe/7z7yhvLh2EXLK9udpETmEbkbzFHsqoVCEhPXi6rw1yPo0 MWV7+eLPWCGVVXTzeyYrmgJTFEPEko2WtFOvVjQD8I28O8iR2U+wwzoZXHrNpNdc 1WKbl8dtcdLnfmnXX1+dtDyBginkNipASo7/4+zSkbRM8HSH+8UMlNdUjQMBCkAR 1wpZdbQ/Ohr5HtsXslyc5JVAXtZmwVcKCE4+Auojg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=xxn161 WyWUMlJN+yGcWcoKSI76pGbgSkyutn0BKb50I=; b=CBls4W+zvf91Kc2kqRgSTD BE5aMGm3OUNvFH8ZTLKcePssAVjE99S59lCqTwLaZT3b31ysoahVw+ClJY/ALvuT z4j0xftpsDwU9W9d/B+e5BzSHWOm+ZZRELErTNV6Nr6VthH+jr9SMS3Jf0Jw0PMT HFQY9yWe2YaG+E+k+lZwSyfOLd24krpY9UAnqum7Au8YwjuU9dDXRW4HjYxBTx+A zDWf4oZPQJVp/xBaYrLnEgfhU3Y79ng+TkuDkWEqpTnQB/n/GrCLremP+6Ta1Z9c 1Hkf9zBlm0YEJVkJqfnJ2UWsZBjWGd7Md66bG/bgicOmxEBuAgwcURC8wP9A54FQ == X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.2] (unknown [71.212.135.74]) by mail.messagingengine.com (Postfix) with ESMTPA id C8D9FE43E8; Sat, 26 May 2018 00:11:44 -0400 (EDT) Subject: Re: Fast logical replication jump start with PG 10 To: Olivier Gautherot Cc: pgsql-general@postgresql.org References: <729c1726-2e61-f03f-fe7e-c1dcf3f59e85@aklaver.com> From: Adrian Klaver Message-ID: <239dddd5-aa45-a7fe-b35a-085b978f8bd6@aklaver.com> Date: Fri, 25 May 2018 21:11:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 05/25/2018 06:35 PM, Olivier Gautherot wrote: > Hi Adrian, thanks for your reply. Here is the clarification. > > 1) It is indeed a pg_upgrade from 9.2 to 10.4. Depending on the test > machine, it runs in between 15 and 20 minutes for just over 100GB. I can > negotiate this time with our customer. The vacuum process took another 5 > to 7 minutes. This this what I was referring to with the 30 minutes > (point 3 in your questions) > > 2) After pg_upgrade, I published the tables on the database (in the > sense "CREATE DATABASE") and subscribed to this publication on the > second server (logical replication). The data copy processed started > immediately and took around 1 hour. I then loaded the indexes, what took > another 2h20m. At that point the active-passive cluster was ready to go. The index creation was done on the replicated machine I presume, using what command? > Note that the active and the passive databases are on different machines. > > 4) By "database" I mean the result of "CREATE DATABASE" and we have 1 > per server (or "cluster" in your terminology - I tend to use this word > for a group of machines). We are currently using a streaming replication Yeah I understand, it is just that database and cluster have specific meanings in Postgres and it helps to stick to those meanings when discussing replication operations. Lowers the confusion level:) > between the 9.2 servers, so it could be a fall-back option after the > upgrade (I wanted to remove part of the indexes on the master to lower > the load, reason to use the logical replication... if the execution time > is not too excessive). So the time you showed was with those indexes removed or not? > > Hope it clarifies the question > Best regards > Olivier > > > Olivier Gautherot > olivier@gautherot.net > Cel:+56 98 730 9361 > Skype: ogautherot > www.gautherot.net > http://www.linkedin.com/in/ogautherot > > On Fri, May 25, 2018 at 7:51 PM, Adrian Klaver > > wrote: > > On 05/25/2018 02:12 PM, Olivier Gautherot wrote: > > Hi, > > I just sent the question on StackOverflow but realized that this > audience may be more savvy. So sorry in advance for cross-posting... > > I'm in the process of upgrading a PG from 9.2 to 10.4. > pg_upgrade worked fine on the master and was rather fast. The > problem is that the database is replicated and I'm planning to > switch from streaming to logical. The problem is that it is > rather slow (30 minutes for the master and over 3 hours for the > replication, between data transfer and indexes). > > > I am not clear on what you did, so can you clarify the following: > > 1) pg_upgrade from 9.2 master instance to 10.4 master instance, correct? > > 2) What replication are you talking about for the 3 hour value? > > 3) What is the 30 minute value referring to? > > 4) When you say database are you talking about a Postgres cluster or > a database in the cluster? > > > Is there a way to speed up the replication or should I rather > stick to streaming replication? As I have only 1 database on the > server, it would not be a show-stopper. > > > See 4) above, but if you are talking about a single database in a > cluster streaming replication will not work for that. > > > > > Thanks in advance > Olivier Gautherot > http://www.linkedin.com/in/ogautherot > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com