Closed crazycs520 closed 3 years ago
Could you describe more on the use scenarios and the motivation of this feature request?
Typically, explain analyze is used for postmortem analysis. For example, we found a statement executed too slow, wish to investigate where the time spent on.
I'm afraid it's not suitable for UPDATE
statements because it changes the data state. This means the slow UPDATE
query can not be reproduced repeatedly. The second EXPLAIN ANALYZE UPDATE
may not able to update anything in some scenarios.
@zz-jason Sorry, Already add a background
description.
My original intention is want to record insert/update/delete
executor runtime information in the Plan
field of slow-log.
Since explain analyze
also need the runtime information, so maybe explain analyze
can also display the insert/update/delete
executor runtime information.
record insert/update/delete executor runtime information in the Plan field of slow-log.
Gotcha, that makes sense to me.@SunRunAway @qw4990 What's your opinion?
Make sense to me.
Make sense to me, but I think we should add extra fields in slow logs for some important behaviors(for example, time cost on commit
and pre-commit
), since some third-party tools like pt-query
may rely on them and it's more friendly to users.
/assign
Added documentation for alerting users it has no explain result for DML now, https://github.com/pingcap/docs-cn/pull/4059 Please update this after this issue is resolved.
Background
After https://github.com/pingcap/tidb/pull/17573, TiDB maybe records the executor runtime information in slow log.
But currently, the executor runtime information doesn't contain the
insert/update/delete
executor runtime information.Feature Request
explain analyze
also need the executor runtime information to display. Currently, explain analyze DML(insert/delete/update
) will return not return the runtime information, here is an example:Describe the feature you'd like:
Add runtime information for DML in explain analyze too. Such as:
rpc time
https://github.com/pingcap/tidb/pull/19334memory
prewrite_time
,commit_time
: https://github.com/pingcap/tidb/pull/19366 . . .Here is an example:
And then, we can record the
insert/update/delete
executor runtime information in slow-log.There is some information we can add for DML and PointGet in explain analyze results (or slow logs): For
PointGet
orBatchGet
:PointGet
#18666BatchGet
#18828For DML:
AutoIncreID/HandleID/AutoRandID
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy: