David Wall <d(dot)wall(at)computer(dot)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