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

planner: update the scan-row-size calculation formula in model2 #38968

Merged
merged 5 commits into from
Nov 9, 2022

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented Nov 8, 2022

What problem does this PR solve?

Issue Number: ref #35240

Problem Summary: planner: update the scan-row-size calculation formula in model2

What is changed and how it works?

see #38967

planner: update the scan-row-size calculation formula in model2.

Current formulas:

  1. index-scan-row-size = row-size(all-index-cols);
  2. table-scan-row-size = row-size(all-table-cols);
  3. tiflash-scan-row-size = row-size(required-cols);

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

@qw4990 qw4990 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner epic/cost-model the optimizer cost model labels Nov 8, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 8, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer
  • time-and-fate

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 Nov 8, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented Nov 8, 2022

/run-build

@qw4990
Copy link
Contributor Author

qw4990 commented Nov 8, 2022

/run-check_dev_2

@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 8, 2022
@@ -31,30 +31,30 @@
{
"SQL": "explain format='verbose' select count(*) from t where a=1",
"Plan": [
"StreamAgg_24 1.00 217.09 root funcs:count(Column#6)->Column#4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expected, just update these cost values.

@@ -1861,8 +1861,8 @@
{
"SQL": "select f, g from t1 where f = 2 and g > 3",
"Plan": [
"IndexReader_6 33.33 752.77 root index:IndexRangeScan_5",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expected, just update these cost values.

@@ -2486,65 +2486,65 @@
{
"SQL": "explain format = 'verbose' select count(*) from t3",
"Plan": [
"StreamAgg_20 1.00 99.31 root funcs:count(Column#9)->Column#4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expected, IndexScan is better than TableScan.

@@ -6333,8 +6333,8 @@
"SQL": "select /*+ straight_join() */ * from t1 join t2 on t1.a=t2.a where t1.a not in (select t3.a from t3)",
"Plan": [
"HashJoin 9990.00 root CARTESIAN anti semi join, other cond:eq(test.t1.a, test.t3.a)",
"├─TableReader(Build) 3.00 root data:TableFullScan",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expected, IndexScan is better than TableScan.

@qw4990 qw4990 requested a review from chrysan November 8, 2022 08:47
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 8, 2022
@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 9, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented Nov 9, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 0942543

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 9, 2022
@ti-chi-bot ti-chi-bot merged commit ce62915 into pingcap:master Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/cost-model the optimizer cost model release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 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. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants