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 1t5T8m-006HB0-SM for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 17:02:53 +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 1t5T8l-008TLJ-5Y for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 17:02:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t5T8k-008TLA-P3 for pgsql-hackers@lists.postgresql.org; Mon, 28 Oct 2024 17:02:51 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5T8e-003Ilr-9c for pgsql-hackers@postgresql.org; Mon, 28 Oct 2024 17:02:49 +0000 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-e2972abc807so4527329276.3 for ; Mon, 28 Oct 2024 10:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeltef.nl; s=google; t=1730134963; x=1730739763; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zjB4EhnS7hYFhwqi6cbjEq5pk8gXdRT5sXzJZ5fB0ow=; b=UzOBsAjIAoAwUwqMWtyCIrLKdm8i4WeLrRxkhmGfp51F3PdeDdPybW16wenXu5A8wj yyFH/uC7RnDRbso4Ot4JAFfxuTpKNiK19+G3GewPfmWoLdOWx8TKqBPscd+Lk/bSSDgD kvNeam2LmygNqnNND2p1D4RmgNIdIOU1lx4QI+2THyhXbiF+w3+TspXofcZNe0u+glG3 niWbeWq6iqqB/BxDuus0M8wh+F3Wn6Uks6bwQqlgnl5HpLPkcHBz5mUAcCe35BarsoYB hN9FkJ997jOzYJ/aZ2VNZEeOkTj6N+wO0qQBaY8XFd/NPQ7siwZupb7m1ol22ey5k5tF amaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730134963; x=1730739763; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zjB4EhnS7hYFhwqi6cbjEq5pk8gXdRT5sXzJZ5fB0ow=; b=JDhYQTKuIdtQMAcfaWgGeFSvYtZtnZQoAo3x8JqtDTJV5svhDm6y8Ceo3iv5aXEwTP h7dx/woMjjXyOSLPqgqsPdVzn9pOoQJh8AQTYbMr3A1T0Zc0jSexLQQOLpiVdNTXIiNs az4G4kPHzucN8dMd8nSC09koagrfOJbUDHwquGuO7Jt/DU0VSkjSpfUayYlt++T989c3 KwlpBKqpgUNUHBmlActXWLRQYMs3qyMTDvJtIPoRn4z6EvHYxOGYRh/eHaDPrAEChWYt QgvT6s6G5G4sy2wGARxYs9a2RaIZ7f2Kgzcx6oZekkXKH+6AWD1oz8+FyVFVwP8zDIQ4 oMHA== X-Gm-Message-State: AOJu0Yz0ROnN9sPL2DOyz/Z/k73udeypFjQmtNnMqrBBjrfGhra5YEao XXrxXFU/x+jUMj7Mb7dLRVB/cCJsqZcCbYug1ebcsa2Wc4vUSfpfdOlDu6jNiGMMn+p59FLQ6N2 FEJ10yxWcqsuDWMPDx56fc8w3LHD8KRGhH9iH+K0OLZ9TYlkg X-Google-Smtp-Source: AGHT+IFWqX5mITMVvlJz6OgpebzIbUcmmWtpVSRMPIvLI1PsxACTfpTx4a42F1LFFGf3pv05UnleTeoTm47+nyGqXz0= X-Received: by 2002:a05:6902:1ac7:b0:e2b:cc1b:c4bb with SMTP id 3f1490d57ef6-e3087a5c8e1mr6370033276.18.1730134962636; Mon, 28 Oct 2024 10:02:42 -0700 (PDT) MIME-Version: 1.0 References: <8e6ba982-fd41-4779-8729-eb120df69ea0@eisentraut.org> In-Reply-To: <8e6ba982-fd41-4779-8729-eb120df69ea0@eisentraut.org> From: Jelte Fennema-Nio Date: Mon, 28 Oct 2024 18:02:30 +0100 Message-ID: Subject: Re: protocol-level wait-for-LSN To: Peter Eisentraut Cc: pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 28 Oct 2024 at 16:51, Peter Eisentraut wrote: > The idea is to do the equivalent of pg_wal_replay_wait() on the protocol > level, so that it is ideally fully transparent to the application code. > The application just issues queries, and they might be serviced by a > primary or a standby, but there is always a correct ordering of reads > after writes. Sounds super useful. This came up in the Unconference session about protocols on PGConf.dev too. I'll > There might be other ways to slice this. Instead of using a > hypothetical middleware, the application would use two connections, one > for writing, one for reading, and the LSN would be communicated between > the two. I imagine in this case, at least the one half of the protocol, > shipping the current LSN with ReadyForQuery, could be useful, instead of > requiring application code to issue pg_current_wal_insert_lsn() explicitly. I think this usecase is already super useful by itself. And having both directions would still be preferred I think.