| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | David Wall <d(dot)wall(at)computer(dot)org> |
| Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred? |
| Date: | 2019-08-25 20:27:48 |
| Message-ID: | 1628.1566764868@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Howard Wells | 2019-08-25 21:59:23 | Re: Postgres SQLSTATE[08006] [7] timeout expired |
| Previous Message | David Wall | 2019-08-25 20:12:30 | Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred? |