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: record index usage for the clustered primary keys #55602

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Aug 23, 2024

What problem does this PR solve?

Issue Number: close #55601

Problem Summary:

Record the index usage for primary keys.

What changed and how does it work?

Also record the scanned rows for clustered primary key in the following executors:

  1. TableReaderExecutor.
  2. IndexMergeExecutor.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Record the index usage statistics for the clustered primary keys

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 23, 2024
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.0005%. Comparing base (3578e29) to head (711600e).
Report is 6 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55602         +/-   ##
=================================================
- Coverage   72.8509%   56.0005%   -16.8504%     
=================================================
  Files          1598       1723        +125     
  Lines        444454     619956     +175502     
=================================================
+ Hits         323789     347179      +23390     
- Misses       100741     249204     +148463     
- Partials      19924      23573       +3649     
Flag Coverage Δ
integration 37.2967% <91.8032%> (?)
unit 71.9761% <100.0000%> (+0.0055%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.8744% <ø> (+7.1011%) ⬆️

@YangKeao YangKeao force-pushed the primary-key-index-usage branch 2 times, most recently from ffc0814 to 3fec58d Compare August 27, 2024 09:24
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 27, 2024
@YangKeao YangKeao force-pushed the primary-key-index-usage branch from 3fec58d to cc43ace Compare August 28, 2024 03:57
@YangKeao YangKeao requested review from bb7133 and qw4990 August 28, 2024 08:27
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 30, 2024
@YangKeao YangKeao requested a review from hawkingrei September 2, 2024 08:47
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Sep 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bb7133, qw4990

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 4, 2024
Copy link

ti-chi-bot bot commented Sep 4, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-30 06:04:02.752519089 +0000 UTC m=+1109437.886969210: ☑️ agreed by qw4990.
  • 2024-09-04 17:53:28.435721393 +0000 UTC m=+466932.953774311: ☑️ agreed by bb7133.

@YangKeao YangKeao force-pushed the primary-key-index-usage branch from cc43ace to 100dc3f Compare September 5, 2024 02:31
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@YangKeao YangKeao force-pushed the primary-key-index-usage branch from 100dc3f to 711600e Compare September 5, 2024 03:52
@ti-chi-bot ti-chi-bot bot merged commit edf1001 into pingcap:master Sep 5, 2024
23 checks passed
breezewish added a commit to breezewish/tidb that referenced this pull request Sep 8, 2024
* origin/master: (33 commits)
  build(deps): bump github.com/prometheus/common from 0.55.0 to 0.57.0 (pingcap#55762)
  build(deps): bump golang.org/x/sys from 0.24.0 to 0.25.0 (pingcap#55894)
  planner: fix incorrect estRows with global index and json column (pingcap#55842)
  ddl, stat: switch to new struct for add/truncate/drop partition (pingcap#55893)
  planner: hide instance plan cache eviction log if no plan is evicted (pingcap#55918)
  expression: support tidb encode key function (pingcap#51678)
  planner: fix incorrect maintenance of `handleColHelper` for recursive CTE (pingcap#55732)
  executor: some code refine of hash join v2 (pingcap#55887)
  infoschema, meta: fix wrong auto id after `rename table` (pingcap#55847)
  ddl/ingest: set `minCommitTS` when detect remote duplicate keys (pingcap#55588)
  planner: move index advisor into the kernel (pingcap#55874)
  ddl, stats: switch to new struct for create/truncate table (pingcap#55811)
  executor: avoid new small objects in probe stage of hash join v2 (pingcap#55855)
  *: Add tidbCPU/tikvCPU into system tables (pingcap#55455)
  ddl: use static contexts in `NewReorgCopContext` (pingcap#55823)
  executor: fix index out of range bug in hash join v2 (pingcap#55864)
  executor: record index usage for the clustered primary keys (pingcap#55602)
  domain: load all non-public tables into infoschema (pingcap#55142)
  test: fix unstable TestShowViewPriv (pingcap#55868)
  ttl: add `varbinary` case for `TestSplitTTLScanRangesWithBytes` (pingcap#55863)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Record clustered index in index usage
3 participants