[odb-users] Can we use odb::query and odb::persist outside of transactions?

Boris Kolpackov boris at codesynthesis.com
Mon Dec 18 04:51:00 EST 2023


Fei Peng <pengfei8244 at gmail.com> writes:

> Can we use odb::query and odb::persist outside of transactions? Or will
> future versions provide related support? Some scenarios do not require
> transactions, such as simple read/write single data. Forcing transactions
> to add additional performance overhead and increase the risk of locking
> tables.

While you did not specify which database you are using (always a good
idea), none of the databases ODB currently supports can perform the
operations in question without requiring a transaction. They can be
performed in implicit transactions (i.e., the transaction is started
automatically immediately before the operation and committed immediately
after), but there is always a transaction. While it's true an implicit
transaction may have a slightly better performance in certain situations
(because there is no need for explicit BEGIN/COMMIT statements), they
are also very error-prone and we currently have no plans to support
them in ODB.



More information about the odb-users mailing list