Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Transactions when reading

42 views
Skip to first unread message

Jens Lideström

unread,
Feb 28, 2023, 12:43:16 PM2/28/23
to
I'm trying to learn the details of transaction management from here: https://docs.yottadb.com/ProgrammersGuide/langfeat.html#transaction-processing

This is my question: Is there every any point in using transactions for code that only READS the database?

That is, enclosing code that only reads from globals in tstart and tcommit.

If so, when is it appropriate?

The documentation seems to say that even code that runs without a transaction will only every read the finished result of writes from a transaction. This vaguely suggests that reads don't need transactions.

I could imagine the following use for transactions for read operations (although I have no idea if this is how it works): To read a snapshot of the database, without seeing ANY updates after the execution of tstart.

Is this what will happen? Or is there no effect at all?

K.S. Bhaskar

unread,
Feb 28, 2023, 1:16:55 PM2/28/23
to
Jens –

If you want Consistency across the reads from the database and the updates that set the values of those globals are not protected by transactions, then yes, it makes sense to put the a set of read-only operations in a transaction.

Since Isolation is the other side of the coin from Consistency, if you want the reads to be stable, then yes, it makes sense to put the read-only operations in a transaction.

Regards
– Bhaskar

Jens Lideström

unread,
Mar 1, 2023, 3:00:06 AM3/1/23
to
Thanks, Bhaskar! That's what I expected.

I take it that the inverse is also true: If I don't need stable values across all reads in an operation, then there is no need for a transaction.

K.S. Bhaskar

unread,
Mar 1, 2023, 10:16:06 AM3/1/23
to
On Wednesday, March 1, 2023 at 3:00:06 AM UTC-5, Jens Lideström wrote:
> Thanks, Bhaskar! That's what I expected.
>
> I take it that the inverse is also true: If I don't need stable values across all reads in an operation, then there is no need for a transaction.

Yes, Jens, that is correct.

Regards
– Bhaskar
0 new messages