diff --git a/session/tidb.go b/session/tidb.go index eaa5aedfbe39d..8a572eec10922 100644 --- a/session/tidb.go +++ b/session/tidb.go @@ -213,7 +213,7 @@ func runStmt(ctx context.Context, sctx sessionctx.Context, s sqlexec.Statement) // If it is not a select statement, we record its slow log here, // then it could include the transaction commit time. if rs == nil { - s.(*executor.ExecStmt).LogSlowQuery(se.GetSessionVars().TxnCtx.StartTS, err != nil) + s.(*executor.ExecStmt).LogSlowQuery(se.GetSessionVars().TxnCtx.StartTS, err == nil) } }()