Why are transaction timestamps are needed when using a read only db?

I’m running badger db in a read-only mode (by passing WithReadOnly(true) when opening the db).

during high load,
I see that a lot of time is spent waiting for the mutex inside readTs in newTransaction.

why are those timestamps needed?
since no data is written, there shouldn’t be use of them, no?

would it make sense to run the db as managed in that case?

Hey Lev, Because badger is MVCC by default, each transaction needs to know which version of a key it can read, even when opening “read-only”. If you don’t need MVCC and are not doing any writes, then opening with WithManagedTxns(true)should bypass the transaction contention you’re seeing.

thanks Mattew,
I’ll try that.

btw, there is no such option WithManagedTxns(true)
the db needs to be opened with OpenManaged instead