Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred? - Mailing list pgsql-general

From Tom Lane
Subject Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?
Date
Msg-id 1628.1566764868@sss.pgh.pa.us
Whole thread Raw
In response to Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), isCOMMIT or ROLLBACK preferred?  (David Wall <d.wall@computer.org>)
List pgsql-general
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



pgsql-general by date:

Previous
From: David Wall
Date:
Subject: Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), isCOMMIT or ROLLBACK preferred?
Next
From: Howard Wells
Date:
Subject: Re: Postgres SQLSTATE[08006] [7] timeout expired