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 1stZuL-00HWES-TQ for pgsql-general@arkaria.postgresql.org; Wed, 25 Sep 2024 21:50:50 +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 1stZuK-00Eveb-QH for pgsql-general@arkaria.postgresql.org; Wed, 25 Sep 2024 21:50:48 +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 1stZuK-00EveT-FK for pgsql-general@lists.postgresql.org; Wed, 25 Sep 2024 21:50:48 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1stZuG-0015NS-3d for pgsql-general@lists.postgresql.org; Wed, 25 Sep 2024 21:50:47 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2f75e5f3debso2771481fa.1 for ; Wed, 25 Sep 2024 14:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727301043; x=1727905843; darn=lists.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=zSKpNtI1tQr4T72oep8m2Wl5RhQKiEyXnOcgE9FUi0I=; b=FxNzUt8Y8SRUtcPQFGyjv5E5iI2dE+iKfLLYTbXjU1pk0wF338cSXfpgllOoHrDH/B y3tLb6gFq5Iebky5dRZVKPV6RND4+VjbJT0IxYGCc8Fu90X1e+F0o4sXRuLyRyV7ztEx lB7IKOfhpBILPtPUEWfoeXH9vjzD8WjVfER6x8HnIZoKSSju0cTPad9l+HG498dQTJ9T vFjUn1QbmN1wH6Xjh+iKlDeEM3jpsf0+XfcjPwZbnDVFNmwEDgJJnMJdYXJ4Kh7NkK5t eSUuS3skxbq/Oxez7uOrjlhgX0A1FQk25C+ptMyhIyr107DDvzzd8utPJwlxJmVMLBB1 fMmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727301043; x=1727905843; 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=zSKpNtI1tQr4T72oep8m2Wl5RhQKiEyXnOcgE9FUi0I=; b=mMnl8xWpUhjRIJsA1Sr3jptrJTkErgAgQ5EVP8lcdjHccYYg0T4nGFtpctlPUZnGD6 thrOYhazhhwV4eoUIK5PuHBjfyBNewBnn/0fXwmpNrUbJd3dt1yWUyJvRwQUJURo9nv9 JJ86Y2ZJR8DYx16svID9MOch7Vz5sl3CM0gVdAGCdUAjpXU3cNPXdFp2OW7AGSLRY5zk AffHrtqI0iB9yBhkonAGjQAYFEgte5JUpi74TJc1/1/KRUq5q0GWyO+5kF21oxxmYPXc AShULF2Y7jNbp8gPfxrdep1wJu1JgbnUjpm8F2/s086DrDrb5+23ali+mZtv+/qBipij igSQ== X-Forwarded-Encrypted: i=1; AJvYcCXTCVHFut/Q/vRnnaIqaGUtaewWX28mtbIZdQZppCI93KIcGt90yFmKio9FwHjZCerxgdo0vx4IpgpW+FJp@lists.postgresql.org X-Gm-Message-State: AOJu0YzNFWvRVSCJWGoRN0wXkVqNl3cRzeatbJUj11oiGVO2IfnG8Qvf NA2Hl+8G2/rxaOxVe3K/XS6mnmbrXL4mjGPKMB+M6hvyGui9IB2mqxkl8S6+HnAG2/v2kZpYZGg KOmZE8liEHyvWHZ1xZFYzDZI9ISQ= X-Google-Smtp-Source: AGHT+IFcH4/xIPc59NwFYoiYtQLrdFyg6j8gzVCs1MxmpM0Z7Fsc1Zdp5J489JLwZiYhUIeraGuqEi3tVco9QnQDPNI= X-Received: by 2002:a05:6512:220d:b0:52c:e159:a998 with SMTP id 2adb3069b0e04-53877530c4fmr2877818e87.29.1727301043117; Wed, 25 Sep 2024 14:50:43 -0700 (PDT) MIME-Version: 1.0 References: <9CEBFAC7-4372-4FF0-8124-FFFE834B03C6@gmail.com> <3346993.1727188126@sss.pgh.pa.us> <28109.1727286817@sss.pgh.pa.us> In-Reply-To: From: Greg Sabino Mullane Date: Wed, 25 Sep 2024 17:50:06 -0400 Message-ID: Subject: Re: Repeatable Read Isolation Level "transaction start time" To: Christophe Pettus Cc: Ron Johnson , "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000001866890622f89d41" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001866890622f89d41 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Sep 25, 2024 at 4:54=E2=80=AFPM Christophe Pettus wrote: > On Sep 25, 2024, at 13:49, Greg Sabino Mullane wrote= : > > BEGIN ISOLATION MODE REPEATABLE READ SNAPSHOT NOW; > > This might well be a failure of imagination on my part, but when would it > pragmatically matter that the snapshot is taken at the first statement as > opposed to at BEGIN? I could imagine lots of cases where you know something is about to happen (say, a major delete), and you want to get a snapshot of the database as it existed just before that point. Many people will (quite understandably) assume that a BEGIN ISOLATION MODE ; command would do just that, and be quite surprised to find that when they actually query the table in that first process, the rows are not there. It's certainly a non-intuitive behavior. I understand why we do it this way, but perhaps this warrants a stronger warning in the docs at least? It's too late in the day for me to tackle that now, but I'll throw it out there. Cheers, Greg --0000000000001866890622f89d41 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Sep 25, 2024 at 4:54=E2=80=AFPM C= hristophe Pettus <xof@thebuild.com> wrote:

> On Sep 25, 2024, at 13:49, Greg Sabino Mullane <htamfids@gmail.com> wrote:
> BEGIN=C2=A0 =C2=A0ISOLATION MODE REPEATABLE READ=C2=A0 =C2=A0SNAPSHOT = NOW;

This might well be a failure of imagination on my part, but when would it p= ragmatically matter that the snapshot is taken at the first statement as op= posed to at BEGIN?

I could imagine lots of = cases where you know something is about to happen (say, a major delete), an= d you want to get a snapshot of the database as it existed just before that= point. Many people will (quite understandably) assume that a BEGIN ISOLATI= ON MODE <non read committed>; command would do just that, and be quit= e surprised to find that when they actually query the table in that first p= rocess, the rows are not there.

It's certainly= a non-intuitive behavior. I understand why we do it this way, but perhaps = this warrants a stronger warning in the docs at least? It's too late in= the day for me to tackle that now, but I'll throw it out there.
<= div>
Cheers,
Greg

--0000000000001866890622f89d41--