Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4kAM-000fsN-A3 for pgsql-general@arkaria.postgresql.org; Wed, 08 May 2024 16:29:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s4k9M-001whw-1w for pgsql-general@arkaria.postgresql.org; Wed, 08 May 2024 16:28:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4k9K-001whX-9i for pgsql-general@lists.postgresql.org; Wed, 08 May 2024 16:28:12 +0000 Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4k9F-0003D1-Ev for pgsql-general@postgresql.org; Wed, 08 May 2024 16:28:09 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id E4DE918000F9; Wed, 8 May 2024 12:28:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 08 May 2024 12:28:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1715185682; x=1715272082; bh=fZvB4lvVfWc0UWTmEMTSoORZs/Zx6wwnEe1CC6rWIFg=; b= k/srsQM5YfQwERmdQpCTQR3y4p1NvjQXi0ekt+mdH7ktLrnhPb/vasFkF9xfW7jr 2qzrhE/thaeUEAMLLPUGqm2g/Ek52HWzQyro5XMb+5EPrJusKmek6oIOe2kdNqK7 VdJOv3mNcaCAKghKc0uzrDBGi5ogoczhc3r9qPUBGVOIsAD/UxW4+t9tCHjjBUCk MkfSPBIS5Rm0sxkU8wtNId3O1+S/C96QU1cIaepzs5/5lIsqY/O1wZJGZz3TsH04 6OCO6Zk9uZhHgCf7ndcQuTnpaO8KN7XT9qmQbLgEqHxsp6ZrLyY70RrDCaJ7/Qq7 xgHiDgUplwYGjHUfriphDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715185682; x= 1715272082; bh=fZvB4lvVfWc0UWTmEMTSoORZs/Zx6wwnEe1CC6rWIFg=; b=N XG/VvBlE2kA3xy/RDT3E/UbKLOh/DOEmrSqj9+wFN8tk6WU12QE/AZ3G7mf23irf 5tElg8C8Km8OM1in+QoIjD1LIAsXkLxREw7aSkHmsxqcIJpbeiOBKUTi2DxzTuRx 8K0WsOZy+6hVm3t/FhpRDBSRGYTQ2/9auqSdUnFk1kvC3lxvmPrk38K7WjBfbgvv 4EH+G2cwcwR2pjF3Hz7shy+YFUEYIQppDYaOcx0OCwZsjxLpouB2vOoVqiWVShM/ RiqRr9XVSJj0ckulS0OiTx6DRwHy5aeTCjxEqnIhMhqdmB3gtvlnrzFFueszB9UY 9eRs6NgkMlTJYX6F+UZeg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeftddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnheplefhteffteettdejiedvueegffevfeekjeetvdfg tddvhfekjefgfedvffefjeevnecuffhomhgrihhnpehvrghrihhouhhsrdhnvghtpdhpoh hsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 May 2024 12:28:01 -0400 (EDT) Message-ID: <10bcc03d-fa3e-40b6-bdd2-cac0acd046f4@aklaver.com> Date: Wed, 8 May 2024 09:28:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Unexpected data when subscribing to logical replication slot To: Daniel McKenzie Cc: pgsql-general@postgresql.org References: <8a534c5f-e400-4bb5-b39e-2017d259ff06@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/8/24 08:24, Daniel McKenzie wrote: > It's running both (in docker containers) and also quite a few more > docker containers running various .NET applications. I think what you found is that the r7a.medium instance is not capable enough to do all that it is asked without introducing lag under load. Answering the questions posed by Tomas Vondra would help get to the actual cause of the lag. In meantime my suspicion is this part: "For example, when I use a psql terminal to update a user's last name from "Jones" to "Smith" then I would expect the enrichment query to find "Smith" but it will sometimes still find "Jones". It finds the old data perhaps 1 in 50 times." If this is being run against the Postgres server my guess is that synchronous_commit=on is causing the commit on the server to wait for the WAL records to be flushed to disk and this is not happening in a timely manner in the '... 1 in 50 times' you mention. In that case you see the old values not the new committed values. This seems to be confirmed when you set synchronous_commit=off and don't see old values. For completeness per: https://www.postgresql.org/docs/current/wal-async-commit.html "However, for short transactions this delay is a major component of the total transaction time. Selecting asynchronous commit mode means that the server returns success as soon as the transaction is logically completed, before the WAL records it generated have actually made their way to disk. This can provide a significant boost in throughput for small transactions. Asynchronous commit introduces the risk of data loss. There is a short time window between the report of transaction completion to the client and the time that the transaction is truly committed (that is, it is guaranteed not to be lost if the server crashes). ... " > > Daniel McKenzie > Software Developer -- Adrian Klaver adrian.klaver@aklaver.com