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 1uw7FJ-006BoP-H2 for pgsql-general@arkaria.postgresql.org; Tue, 09 Sep 2025 22:55:30 +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 1uw7FH-00FKe3-Ah for pgsql-general@arkaria.postgresql.org; Tue, 09 Sep 2025 22:55:27 +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 1uw7FG-00FKdv-PQ for pgsql-general@lists.postgresql.org; Tue, 09 Sep 2025 22:55:27 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uw7FF-001YJD-0G for pgsql-general@postgresql.org; Tue, 09 Sep 2025 22:55:25 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-56afe77bc1eso296430e87.0 for ; Tue, 09 Sep 2025 15:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757458523; x=1758063323; 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=adqwug8RV+dRyKQ1l4ETgvzw1Fq0SQPqW4lCvMNvCGs=; b=Q1+XglkFnKlPR3awR2ZHizZr62zbcmoqkQYkagVCwWTnX/KbvVYU/IRq6fhZoh/zLF kMtUhFhk1agEKoCghCerbMzbb90U28+WWvya+c7up30B4nDsG7cRIbtMXk5Hymc4yFtK 0Bw2v19f/Kx05n6dZiO1/pBzM8pnzxuWPD28dADV3HEyBZAPQqYDTL2loL7FA7711vIZ cXnN7zpRg7xnZ+gTINGO2wJSSicgfZQVtOc567eBw+fPtLXIyQnZs7C9P4dJFdB9ug5u dH1VYqb1EVikjanAwNuz5z3351+lYB8WwWWAcS1Vw2hJZ0yPD57OPpSE4cGVOfyz3U/C Kn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757458523; x=1758063323; 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=adqwug8RV+dRyKQ1l4ETgvzw1Fq0SQPqW4lCvMNvCGs=; b=Y8HP+yMeDgnMz4wcMSDP4qDF7zVf0tLDj2z9OlBr/PnwuJaAdZ9SXc7O1yQ4Q+UGxS Dreh1JosUABkGXs/UtY3H1q+zqXvCFfBEn28w6CRTccMe56YM6nUhpcPQWL+e2nVYIjt Uu9Lq+FQOCPeIoK0q6gpPb52+oG+RmoO8Ji7VLnNSv30A6mXeFXn8OzR+Z+q3uExW5Fz tGn61fD60IlQ8WclLOQpqIdN3424UZ51BPmSZfpsucEEqY2hDTEQOMn/rWPQZXAPdAky 5UEvxRi0Urq60jf+CFN1vQmvUkJV4Eb+l/h8CQg8DVPUKI3KGYpnpwIdLPEt2OFI51Ph DMBA== X-Gm-Message-State: AOJu0YxI7otqI6zqme6BaiN9HMWTWB0NvDIdi5xBiuz1vsS0B1kPOo88 naiWuLLukKZSBt7D7BoxqqQpqrkvTj2zJqN75RFLpZBnhmxlb3MUnet/BZr1wnMPjL1/IRAcXBz v4ooSmgnhhnght00wVJRvi7kAnQEHeVA= X-Gm-Gg: ASbGncvhpi7497zoL3mZh6MtcU7ajRkavi/R1w5rUKHQn2CnkqYnLmJ05NYjmKF6pnR iG3QzMONEBRow3jBCrm/jRgvkzO7ep6K4wknKnPClxSH0m+5rTxX/gtQl0eZrVvXANhZ46s/UhE 4rZV/QPdVElWWrSl1R6nTDqgGxF3RN73iPRBWyJpSIqkrv/UwxOR8CFZIVuVqO0vcP4i4yyCcK0 m8Whyziul6KicJKbQr3BFIVB4Fq5OkO4ZjlPldA0VocMCcMVplLpaCS7I97LrgnmEPz3UdgWZ9C c+HwKGY= X-Google-Smtp-Source: AGHT+IHDV85JjoSCufWltocV4LnYFpoWo31xypSVPtpV6Qo0whwFYe+F4gVDNq0CtRnvbDMsFj8LW51ELhOA+22J6PU= X-Received: by 2002:a05:6512:2244:b0:55f:4839:d049 with SMTP id 2adb3069b0e04-56262d23b1bmr3937652e87.39.1757458522687; Tue, 09 Sep 2025 15:55:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Merlin Moncure Date: Tue, 9 Sep 2025 16:55:09 -0600 X-Gm-Features: AS18NWAnr_WNI286Joy0lLSmBBJuyt8mhViNaSGdN2RPnbuUxnBdLvrHkOPOmOo Message-ID: Subject: Re: MVCC and all that... To: Ellen Allhatatlan Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000f3ce0f063e66329c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f3ce0f063e66329c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 9, 2025 at 11:57=E2=80=AFAM Ellen Allhatatlan < ellenallhatatlan@gmail.com> wrote: > > Note: your link is wrong, corrected here: > > Extra hyphen - sorry about and thanks for pointing it out! > > > What the article is driving at is that postgres does not use rollback > logs to handle updated records in the MVCC implementation. There are > absolutely performance tradeoffs in that decision and, if you do a lot of > development against postgresql, those tradeoffs should influence how you > design databases. The author then cherry picked the 'worst case' case, > large unconstrained updates. > > Hmm... I was wondering about that - even though he stressed that there > was (paraphrasing) no right or wrong - just different design > decisions! > > > The article is a bit of a cheezy dig on postgres. Another example is > the complaint about autonomous transactions with another cherry picked > example to make postgres look back. In the real world, these would not > matter much, and can be worked around (if you want to see my take on how = to > deal with it, see here: https://github.com/leaselock/pgasync). > > OK - so, I was wrong in my original assumption that somehow (and it > wasn't simply because of the phraseology - sweep vs vacuum) I thought > that PG and FB had a similar MVCC implementation vs. Oracle and MySQL > (InnoDB) (and OrioleDB). I'll do a deep dive into their docco and see > what they actually do! I'm actually very interested in the > benchmarking side of database technology - but I do know the old adage > - there are lies, damned lies, statistics and *_then_* there are > database benchmarks (as seen with the link I posted!). > Sure. I think you'll find that postgres approach to MVCC is somewhat unusual relative to other players in this space, which is to write 'old' records or changes in a rollback log; if the transaction commits it is discarded but if it rolls back, the rollback log is written back to the heap. This makes rollbacks potentially very painful. I suspect the postgres approach can also do better in cases of highly contended records, but that's just a guess. For small (one or a small number of records) updates, the approach doesn't make a whole lot of difference especially if you are aware of and exploit HOT. For very large updates however, it absolutely does, and one might try to avoid them using various strategies. I very much appreciate fast rollbacks though. merlin merlin --000000000000f3ce0f063e66329c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Sep 9, 2025 at 11:57=E2=80=AFAM E= llen Allhatatlan <ellenall= hatatlan@gmail.com> wrote:
> Note: y= our link is wrong, corrected here:

Extra hyphen - sorry about and thanks for pointing it out!

> What the article is driving at is that postgres does not use rollback = logs to handle updated records in the MVCC implementation.=C2=A0 There are = absolutely performance tradeoffs in that decision and, if you do a lot of d= evelopment against postgresql, those tradeoffs should influence how you des= ign databases.=C2=A0 The author then cherry picked the 'worst case'= case, large unconstrained updates.

Hmm... I was wondering about that - even though he stressed that there
was (paraphrasing) no right or wrong - just different design
decisions!

> The article is a bit of a cheezy dig on postgres.=C2=A0 Another exampl= e is the complaint about autonomous transactions with another cherry picked= example to make postgres look back. In the real world, these would not mat= ter much, and can be worked around (if you want to see my take on how to de= al with it, see here: https://github.com/leaselock/pgasync)= .

OK - so, I was wrong in my original assumption that somehow (and it
wasn't simply because of the phraseology - sweep vs vacuum) I thought that PG and FB had a similar MVCC implementation vs. Oracle and MySQL
(InnoDB) (and OrioleDB). I'll do a deep dive into their docco and see what they actually do! I'm actually very interested in the
benchmarking side of database technology - but I do know the old adage
- there are lies, damned lies, statistics and *_then_* there are
database benchmarks (as seen with the link I posted!).

Sure. I think you'll find that postgres approach to MVC= C is somewhat unusual relative to other players in this space, which is to = write 'old' records or changes in a rollback log; if the transactio= n commits it is discarded but if it rolls back, the rollback log is written= back to the heap.=C2=A0 This makes rollbacks potentially very painful.=C2= =A0 I suspect the postgres approach can also do better in cases of highly c= ontended records, but that's just a guess.

For= small (one or a small number of records) updates, the approach doesn't= make a whole lot of difference especially if you are aware of and exploit = HOT.=C2=A0 For very large updates however, it absolutely does, and one migh= t try to avoid them using various strategies.=C2=A0 I very much appreciate = fast rollbacks though.

merlin

=




merlin=C2= =A0
--000000000000f3ce0f063e66329c--