On Wed, Sep 25, 2024 at 4:50 PM Greg Sabino Mullane <htamfids@gmail.com> wrote:
Since transactions should be "as short as possible, without being too short", how much time is there between when you run "BEGIN;" and the first "work statement"?
I don't know that it really matters. For something automated, it would be a few milliseconds.
That's what I'm thinking, too. It might cause a problem if you're typing transaction commands in between drinking coffee and poking around other PgAdmin tabs, but that's your fault, not PG's fault.
Either way, I'm sure most people/apps already think of the initial 'BEGIN ...' as the start of the transaction, and act accordingly.
Maybe long-term something like
BEGIN ISOLATION MODE REPEATABLE READ SNAPSHOT NOW;
Without the "NOW", that's essentially the command used by the legacy rdbms which I used to work on.
I'm trying to remember, though, if "SET TRANSACTION READ WRITE RESERVING foo FOR <isolation level>;" (it's syntax for beginning a transaction) started the transaction, or waited until an "action" statement. Been too long.