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: reuse chunk row for insert on duplicate update #12847

Merged
merged 6 commits into from
Oct 23, 2019

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Oct 21, 2019

Signed-off-by: Shuaipeng Yu [email protected]

What problem does this PR solve?

MutRowFromDatums hurts the performance when there are many columns in the table when updating the duplicate keys.

What is changed and how it works?

Reuse chunk row for insert on duplicate update.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. insert 100000 rows in a sysbench table
  2. modify the insert lua script of sysbench, replace insert to insert on duplicate
  3. run sysbench with 100 threads, and ignore all errors.
  4. profile TiDB to checkout the usage of mutXX in doDupRowUpdate.

master:
企业微信截图_20191021143810
this PR:
企业微信截图_20191021193439

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch

@jackysp jackysp requested a review from a team as a code owner October 21, 2019 06:51
@ghost ghost removed their request for review October 21, 2019 06:51
@jackysp
Copy link
Member Author

jackysp commented Oct 21, 2019

/run-unit-test

@codecov
Copy link

codecov bot commented Oct 21, 2019

Codecov Report

Merging #12847 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12847   +/-   ##
===========================================
  Coverage   79.8991%   79.8991%           
===========================================
  Files           465        465           
  Lines        107632     107632           
===========================================
  Hits          85997      85997           
  Misses        15142      15142           
  Partials       6493       6493

@imtbkcat
Copy link

/run-all-tests tidb-test=pr/875

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackysp
Copy link
Member Author

jackysp commented Oct 23, 2019

/bench

@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

Benchmark Report

Run Sysbench Performance Test on VMs

@@                               Benchmark Diff                               @@
================================================================================
--- tidb: 46968add5106ea98e58facd32ee970e491b53434
+++ tidb: 9e7f6b303990d465af873462cf18bb4ca94f43d9
tikv: 7e9140667cda003b5ddf51f4acf8bec2cd76dd22
pd: 1af456e3b493dc1e9de5ef85ab7595909b4d9796
================================================================================
oltp_update_non_index:
    * QPS: 4031.08 ± 1.02% (std=27.32) delta: 1.98% (p=0.023)
    * Latency p50: 31.75 ± 1.02% (std=0.21) delta: -1.95%
    * Latency p99: 82.47 ± 1.20% (std=0.70) delta: -0.59%
            
oltp_insert:
    * QPS: 4701.44 ± 0.25% (std=9.21) delta: 0.19% (p=0.261)
    * Latency p50: 27.22 ± 0.25% (std=0.05) delta: -0.18%
    * Latency p99: 50.12 ± 1.81% (std=0.91) delta: -2.26%
            
oltp_read_write:
    * QPS: 10972.92 ± 0.11% (std=9.81) delta: -0.22% (p=0.872)
    * Latency p50: 233.64 ± 0.08% (std=0.14) delta: 0.20%
    * Latency p99: 376.49 ± 0.00% (std=0.00) delta: 0.00%
            
oltp_update_index:
    * QPS: 4368.14 ± 0.40% (std=10.41) delta: 0.31% (p=0.551)
    * Latency p50: 29.34 ± 0.09% (std=0.02) delta: -0.14%
    * Latency p99: 53.62 ± 4.09% (std=1.44) delta: -2.22%
            
oltp_point_select:
    * QPS: 32936.19 ± 0.81% (std=173.81) delta: 0.21% (p=0.558)
    * Latency p50: 3.89 ± 0.90% (std=0.02) delta: -0.19%
    * Latency p99: 13.34 ± 0.90% (std=0.12) delta: -0.91%
            

Signed-off-by: Shuaipeng Yu <[email protected]>
@zyxbest
Copy link
Contributor

zyxbest commented Oct 23, 2019

/run-unit-test

@jackysp jackysp requested review from lysu and coocood October 23, 2019 09:07
@coocood
Copy link
Member

coocood commented Oct 23, 2019

LGTM

@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Oct 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

@jackysp merge failed.

@jackysp jackysp added status/can-merge Indicates a PR has been approved by a committer. and removed status/can-merge Indicates a PR has been approved by a committer. type/performance labels Oct 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

@jackysp merge failed.

@jackysp jackysp merged commit 7321399 into pingcap:master Oct 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

cherry pick to release-3.0 failed

@sre-bot
Copy link
Contributor

sre-bot commented Oct 23, 2019

cherry pick to release-3.1 failed

lfkdsk added a commit to JustProject/tidb that referenced this pull request Oct 26, 2019
…ect/tidb into feature-add-udf-support

* 'feature-add-udf-support' of https://github.com/JustProject/tidb: (26 commits)
  *: fix bug that the kill command doesn't work when the killed session is waiting for the pessimistic lock (pingcap#12852)
  executor: fix the projection upon the indexLookUp in indexLookUpJoin can't get result. (pingcap#12889)
  planner, executor: support create view on union (pingcap#12595)
  planner/cascades: introduce TransformationID in cascades planner (pingcap#12879)
  executor: fix data race in test (pingcap#12910)
  executor: reuse chunk row for insert on duplicate update (pingcap#12847)
  ddl: speed up tests (pingcap#12888)
  executor: speed up test (pingcap#12896)
  expression: implement vectorized evaluation for `builtinSecondSig` (pingcap#12886)
  expression: implement vectorized evaluation for `builtinJSONObjectSig` (pingcap#12663)
  expression: speed up builtinRepeatSig by using MergeNulls (pingcap#12674)
  expression: speed up unit tests under the expression package (pingcap#12887)
  store,kv: snapshot doesn't cache the non-exists kv entries lead to poor 'insert ignore' performance (pingcap#12872)
  executor: fix data race in `GetDirtyTable()` (pingcap#12767)
  domain: increase TTL to reduce the occurrence of reporting min startTS errors (pingcap#12578)
  executor: split test for speed up (pingcap#12881)
  executor: fix inconsistent of grants privileges with MySQL when executing `grant all on ...` (pingcap#12330)
  expression: implement vectorized evaluation for `builtinJSONUnquoteSig` (pingcap#12841)
  tune grpc connection count between tidb and tikv (pingcap#12884)
  Makefile: change test parallel to 8 (pingcap#12885)
  ...
jackysp added a commit to jackysp/tidb that referenced this pull request Oct 29, 2019
Conflicts:
executor/insert.go
expression/column.go
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
@jackysp jackysp deleted the reuse_insert_chunk branch February 27, 2020 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants