Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhwdB-0006oD-4r for pgsql-general@arkaria.postgresql.org; Fri, 22 Apr 2022 16:59:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhwd9-0000kN-CJ for pgsql-general@arkaria.postgresql.org; Fri, 22 Apr 2022 16:59:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhwd9-0000kE-1Z for pgsql-general@lists.postgresql.org; Fri, 22 Apr 2022 16:59:39 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhwd6-00020Z-G7 for pgsql-general@lists.postgresql.org; Fri, 22 Apr 2022 16:59:38 +0000 Received: from localhost (pc-227-216-214-201.cm.vtr.net [201.214.216.227]) (Authenticated sender: andrew@acooke.org) by mail.gandi.net (Postfix) with ESMTPA id 2A0261C0005; Fri, 22 Apr 2022 16:59:31 +0000 (UTC) Received: from localhost (localhost [IPv6:::1]) by localhost (Postfix) with ESMTP id 2AB537DBA8; Fri, 22 Apr 2022 12:59:29 -0400 (-04) Date: Fri, 22 Apr 2022 12:59:29 -0400 From: andrew cooke To: "David G. Johnston" Cc: "pgsql-generallists.postgresql.org" Subject: Re: Logical subscription / publication lifetimes Message-ID: <20220422165929.ziyzyk5ivahr63iy@acooke.org> References: <20220422120039.rpvohhfllv3s2im7@acooke.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ah, thanks! I should have read the documentation of all the parameters! So the portion of data that is covered by "copy_data" is going to reflect updates and deletes prior to the creation of the slot even if "publish=insert" (only)? This makes sense because I can't see how else it could be practically implemented, but just want to be sure I am understanding. The idea that there are two phases (copy existing data then replicate operations) is a big help. Thanks again, Andrew On Fri, Apr 22, 2022 at 09:13:15AM -0700, David G. Johnston wrote: > On Fri, Apr 22, 2022 at 5:00 AM andrew cooke wrote: > > > > > If I define a publication at time Tp, then load some data on the > > publisher, then start a subscription at time Ts, then load some more > > data on the publisher, does the subscriber get data from Tp or Ts > > onwards? > > > > > It depends. By default, neither, the publisher is publishing the entire > contents of the table and the subscriber will do everything necessary to > replicate those contents in their entirety. > > If you specify copy_data = false I'm not sure what you end up with > initially or after disable. My guess is the subscription defines the first > transaction it cares about when it connects to the publisher, defaulting to > the most recent publisher transaction (all older transactions would be > handled via copy_data = true) but then so long as the slot remains active > the publisher will place the data into the slot even while the subscriber > is not active and the subscriber will receive all of it next time it comes > online/re-enables. > > David J.