diff --git a/sql/executor.go b/sql/executor.go index dbfef1e97143..0c486a4b8f85 100644 --- a/sql/executor.go +++ b/sql/executor.go @@ -881,6 +881,9 @@ func (e *Executor) execStmtInOpenTxn( planMaker.evalCtx.SetTxnTimestamp(txnState.sqlTimestamp) planMaker.evalCtx.SetStmtTimestamp(e.cfg.Clock.PhysicalTime()) + session := planMaker.session + log.Event(session.context, stmt.String()) + // TODO(cdo): Figure out how to not double count on retries. e.updateStmtCounts(stmt) switch s := stmt.(type) { @@ -980,9 +983,6 @@ func (e *Executor) execStmtInOpenTxn( return Result{PGTag: s.StatementTag()}, nil } - session := planMaker.session - log.Event(session.context, stmt.String()) - result, err := e.execStmt(stmt, planMaker, implicitTxn /* autoCommit */) if err != nil { if traceSQL {