From 1feb5ba2d3cab5fb90975ac91c621d20afb8bcee Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 5 Aug 2025 11:11:00 +0300 Subject: [PATCH] perf/vdbe: avoid doing work in commit_txn if not in txn --- core/vdbe/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index 04ba851ba..efc838839 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -445,6 +445,11 @@ impl Program { mv_store: Option<&Arc>, rollback: bool, ) -> Result { + if self.connection.transaction_state.get() == TransactionState::None && mv_store.is_none() { + // No need to do any work here if not in tx. Current MVCC logic doesn't work with this assumption, + // hence the mv_store.is_none() check. + return Ok(StepResult::Done); + } if let Some(mv_store) = mv_store { let conn = self.connection.clone(); let auto_commit = conn.auto_commit.get();