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.96) (envelope-from ) id 1w4vr0-002hyk-0n for pgsql-novice@arkaria.postgresql.org; Tue, 24 Mar 2026 07:07:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4vqy-004zGA-1d for pgsql-novice@arkaria.postgresql.org; Tue, 24 Mar 2026 07:07:04 +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.96) (envelope-from ) id 1w4vqy-004zG2-0l for pgsql-novice@lists.postgresql.org; Tue, 24 Mar 2026 07:07:04 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4vqw-00000000pqN-0l9l for pgsql-novice@lists.postgresql.org; Tue, 24 Mar 2026 07:07:04 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-439b9b1900bso2461844f8f.1 for ; Tue, 24 Mar 2026 00:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774336022; x=1774940822; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=blZblFHD2G7ukRha8405PT1jKaoj97KjWCJKOByrcQc=; b=de5AHBMGDRpnY8i6EYT0z/rg9FwiVB3Yc3aNwH1pbtVWxKmDi4f2WZ3sj2hKkbra8D RDhcqb74bGNAl7jgSbnCsWE6r6anhjyWSmdCsVi3ZWCeHf7l3mDCQtc0NPp2Qm77hBgd sCATR9g37CArKjeiJ49UF2imdd/jAvdhiitwWZiow+8BQit9haxrI8QhROL+CqLY8548 0Kt9WAEXRs+ZTPXTN3sgM6odnxqIn4lq3x+vqG5hF4jWAgGof0Iv1qjeoc0u5kbjI14J TB37wtghEu1NPwj2fmvwnZoRL4F/DQBPkDEoQ/vBJxLRGI0BNt/4LbUgszI29LPJJW+K /Fuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774336022; x=1774940822; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=blZblFHD2G7ukRha8405PT1jKaoj97KjWCJKOByrcQc=; b=lIzf+hoXkHlKLy5wDb5kuXC+D4xqAo9YWehJp3inyiTQiJ8KYHYWPWyVERzrOeFSzD of8zzntwXX+krLwz0WPm9Z2x63LhojVYIpoQQqMAbO6dk7UxmvSCk4tV/yOVWsr79DA1 /Y8L0LIikoqQRXJ3NE/r4VSjvBx1+7mKyrBDWPqh4L+DRhn/3gEVl7ORxFC3KCE900x9 E6nsYxn4YXmtL4+Kpe43RMlVaz1yfxefDz3UQX6bAx5gL5MseD2C0oKTL7An0kRhX/V1 4qlcyV6q+GeK4mODSYh0hpHZbB6rTd10gcw9J84GzxGCLrtty5qu8xwNxivO0/8rZSBy 4vXg== X-Forwarded-Encrypted: i=1; AJvYcCVFQKqOv1eB14d+EkiqSyK9NUpOy/KW4uibAR5UbXxnivwglvaMzI8e5Z4YVq8arCiUTVyTBzZ2gpySSzk=@lists.postgresql.org X-Gm-Message-State: AOJu0YzjRUlO97pb1yxORmARJlMk3ZLtliHdqhKzVr4lhtQ5wlTalEf6 8qh/LEjhp4L7agTi4RnnYGTKNLqNAtpAlEpkmPG7eYcuL/FsqqP8M2x0UbVtlPuPuOI= X-Gm-Gg: ATEYQzxuWBeBAHF79peatlTT8DEVjIfdYzFz2DIcx7Ztvu8ekRQ2M6X9E9XDtsoEbat 1sBXJX346K2VNAXfOAp7DdGEQo37zyhJah91cSf7gs1g0tvD5kvfx1a8zxLNJkuPXg2P2eIakXM Cy9rfxrpQoeyit9prZnJogvyvcPeY78WG5PQXqrY9nDmoyq4j5u9oxdDDdy7OwbVQPMc36uOCJc Khl9cK+K/Aik03HUk5RUYXMgl0bAKU0w3T74Ao6XGQOENj2ntTZ5XNhLoIfjSW8mTTjX6ax5V0Q eeSxcho2DIg3gPT/Uns4uVQSA+SYgzispJSqhsywEGRSRFT6PDQTtpWIiJRZkbpr3VSeI4BJW25 PAg1fPLsBxtt+f9YuENk0KR3cKIyXNDLDjv94ulXvQ106AMduPY4epka4tkupXdO1cPNW0LKfno ua4EOB7wKuziQQR9iiMd1ZR1kSUGE33Zv4+mbqSaOTnuHYiTghfMxgKOg= X-Received: by 2002:a05:6000:18a6:b0:43b:492c:8345 with SMTP id ffacd0b85a97d-43b6423f920mr21601179f8f.10.1774336021611; Tue, 24 Mar 2026 00:07:01 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4fd5:603f:45c2:9807:c104]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b64717e97sm37550927f8f.35.2026.03.24.00.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 00:07:01 -0700 (PDT) Message-ID: <013104103e016e84d59c1e2accb0b1b1f99d9870.camel@cybertec.at> Subject: Re: Replication Testing- How to introduce a Lag From: Laurenz Albe To: "Subramanian,Ramachandran" , "pgsql-novice@lists.postgresql.org" Date: Tue, 24 Mar 2026 08:07:00 +0100 In-Reply-To: References: <8b38fa5141905f9ad6983b8d5ae944e812e3d28a.camel@cybertec.at> <0e00fcc0062b59b88f98dba4900ce49d5a9a3fea.camel@cybertec.at> <477369bf897b44feb2d2368f6fca93fc@alte-leipziger.de> <89d63402747edb3bf80ff668fdd63cc77334f446.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2026-03-24 at 06:14 +0000, Subramanian,Ramachandran wrote: > I noticed that if I insert one row in a table at the source, the differen= ce in LSNs > is not 1 .=C2=A0 ( with a delibrately introduced delay on the apply side = ),=20 >=20 > It is sometimes 96, sometimes 296 ( for the same table two inserts=C2=A0 = ) . Right, because the LSN is not a counter that increases with each new WAL record. It is a position in the WAL stream. The difference between the LSNs of two adjacent WAL records is not 1, but the byte count of the first WAL record. For example: if you insert a larger row, the LSN will advance more. Note also that not all inserts will produce the same kind of WAL: one insert might write a full page image to the WAL, while the next a normal insert record. > Is there a method to calculate the APPROXIMATE amount of data in ( Bytes = ) > that are yet to be transfered from Source to Standby ? That's exactly what pg_wal_lsn_diff() does. What is your worry? What is your ultimate goal? Yours, Laurenz Albe