Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: refine EXPLAIN ANALYZE info for INSERT IGNORE statement #38770

Merged
merged 6 commits into from
Nov 1, 2022

Conversation

crazycs520
Copy link
Contributor

Signed-off-by: crazycs520 crazycs520@gmail.com

What problem does this PR solve?

Issue Number: close #38769

example:

prepare:

set @@global.tidb_enable_foreign_key=1;
set @@foreign_key_checks=1;
create table t1 (id int key);
create table t2 (id int key);
create table t3 (id int key, id1 int, id2 int, constraint fk_id1 foreign key (id1) references t1 (id) on delete cascade, constraint fk_id2 foreign key (id2) references t2 (id) on delete cascade);
insert into t1 values (1), (2);
insert into t2 values (1);

Now you can see fk_check: 54.8µs, fk_num: 3 information in Isert execution info.

mysql>explain analyze insert ignore into t3 values (1, 1, 1), (2, 1, 1), (3, 2, 1), (4, 1, 1), (5, 2, 1), (6, 2, 1);
+----------+---------+---------+------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+---------+------+
| id       | estRows | actRows | task | access object | execution info                                                                                                                                                                                   | operator info | memory  | disk |
+----------+---------+---------+------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+---------+------+
| Insert_1 | N/A     | 0       | root |               | time:113µs, loops:1, prepare: 12.6µs, check_insert: {total_time: 100.4µs, mem_insert_time: 90.9µs, prefetch: 9.58µs, fk_check: 54.8µs, fk_num: 3, rpc:{BatchGet:{num_rpc:3, total_time:19.8µs}}} | N/A           | 1.90 KB | N/A  |
+----------+---------+---------+------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+---------+------+

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 31, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lcwangchao
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 31, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 1, 2022
@tangenta tangenta changed the title executor: Refine EXPLAIN ANALYZE information for INSERT IGNORE statement executor: refine EXPLAIN ANALYZE info for INSERT IGNORE statement Nov 1, 2022
executor/insert_common.go Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 1, 2022
@hawkingrei
Copy link
Member

@crazycs520

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e47276]

goroutine 113000 [running]:
testing.tRunner.func1.2({0x481cfc0, 0x748b9e0})
	GOROOT/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	GOROOT/src/testing/testing.go:1399 +0x39f
panic({0x481cfc0, 0x748b9e0})
	GOROOT/src/runtime/panic.go:884 +0x212
github.com/pingcap/tidb/executor.(*InsertRuntimeStat).String(0xc0043a8f28)
	executor/insert_common.go:1344 +0x4d6
github.com/pingcap/tidb/executor_test.TestInsertRuntimeStat(0x0?)
	executor/insert_test.go:1544 +0xba
testing.tRunner(0xc03659cb60, 0x4f55db8)
	GOROOT/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	GOROOT/src/testing/testing.go:1493 +0x35f

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 06761f9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 1, 2022
@ti-chi-bot ti-chi-bot merged commit a1de01d into pingcap:master Nov 1, 2022
@crazycs520 crazycs520 deleted the fk-insert-stats branch November 1, 2022 10:18
@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/integration-common-test 🟥 failed 1, success 16, total 17 9 min 54 sec New failing
idc-jenkins-ci-tidb/integration-ddl-test ✅ all 6 tests passed 29 min Fixed
idc-jenkins-ci/integration-cdc-test 🟢 all 38 tests passed 20 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 10 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 6 min 50 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 5 min 31 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 4 min 40 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 20 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 1 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine EXPLAIN ANALYZE information for INSERT IGNORE statement.
6 participants