Check the duration of the database transaction.
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Feature Request
**Is your feature request related to a problem? Please describe:**
Some customers have database tasks that take a long time to execute, which may involve long transactions. They may need to adjust max-txn-ttl, but the lack of precise transaction execution time makes it difficult to reference empirical values.
**Describe the feature you'd like:**
Inquire about the specific execution time of the transaction.
**Describe alternatives you've considered:**
The simplest way is to print debug logs when the transaction is successfully committed, just like this.
```go
if !isInternalTxn {
logutil.Logger(ctx).Debug("commit success",
zap.Uint64("txnStartTS", s.GetSessionVars().TxnCtx.StartTS),
zap.Int("statementCount", counter),
zap.Duration("duration", time.Since(s.GetSessionVars().TxnCtx.CreateTime)))
}
```
**Teachability, Documentation, Adoption, Migration Strategy:**
Contributor guide
Assessment
This issue has not been assessed yet.