From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Wall <d.wall@computer.org>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?
Date: Sun, 25 Aug 2019 16:27:48 -0400
Message-ID: <1628.1566764868@sss.pgh.pa.us> (raw)
In-Reply-To: <bd843506-a7d9-6ab3-f4d8-2d6b592ddf0c@computer.org>
References: <3e16442c-a60a-679a-e72e-6d895552b6f8@computer.org>
<3C2ED636-A81D-4BC4-92A1-38634F5DD5D2@gmail.com>
<bd843506-a7d9-6ab3-f4d8-2d6b592ddf0c@computer.org>
David Wall <d.wall@computer.org> writes:
> ... So we're trying to determine
> if there's actually any difference between commit/rollback after SELECT
> statements (with rows returned or not), a bit like if there's any
> difference for an UPDATE statement that returns zero rows were updated.
They're different code paths, but I'd expect any performance difference
to be at the noise level; if nothing happened in the transaction then
no WAL traffic will be emitted in either case.
A more useful thing to think about, IMO, is this: if your app thinks
that the statement had no side-effects but actually it did (maybe it
called a volatile function that did something), would you want those
effects to be persisted or not?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, d.wall@computer.org
Subject: Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?
In-Reply-To: <1628.1566764868@sss.pgh.pa.us>
References: <3e16442c-a60a-679a-e72e-6d895552b6f8@computer.org> <3C2ED636-A81D-4BC4-92A1-38634F5DD5D2@gmail.com> <bd843506-a7d9-6ab3-f4d8-2d6b592ddf0c@computer.org> <1628.1566764868@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox