statement subtransaction journal
(1) By sqlite3_preupdate_count (XiongZaiBingGan) on 2021-02-18 12:21:31 [link] [source]
Who can give me an example to show which scenario will use the 'statement subtransaction journal '?
(2) By David Raymond (dvdraymond) on 2021-02-18 14:41:15 in reply to 1 [link] [source]
Did you read the description here?
(3) By sqlite3_preupdate_count (XiongZaiBingGan) on 2021-02-19 13:08:47 in reply to 2 [source]
Thanks.As the document describes,'statement journal' seems like 'save point'.
No, a statement journal is conceptually a journal that contains only the rollback information for a single statement.
If the statement fails, then the entire statement rollback journal is used to rollback the effects of the single statement, and then deleted.
If the statement succeeds, then the statement rollback journal is either (a) deleted if no transaction is in progress; or, (b) appended to the transaction rollback journal if a transaction is in progress.
The exact mechanics of this process is an implementation detail of no consequence and subject to change. It might be, for example, implemented entirely as an in-memory write-ahead journal, as an on-disk rollback journal, as part of the normal rollback journal or write-ahead journal, or by some other means entirely.
The point is that it is used to ensure an atomic update at the statement level whether or not the particular statement is part of a larger (outer) transaction or not. It is irrelevant (to the user) how this is done, merely that it is done.
In some cases this may require the use of a temporary file and if this is the case, you are hereby given warning of that possibility.
Of what possible consequence can it possibly be whether in any particular set of circumstances such a temporary file is used?