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

Storages: Add statistical data of TableScanning in ScanContext (release-7.5) #8900

Merged
merged 7 commits into from
May 8, 2024

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Apr 3, 2024

cherry-pick #8676, #8842 to release-7.5


What problem does this PR solve?

Issue Number: ref #8675

Related tidb PR: pingcap/tidb#52338

What is changed and how it works?

  • Add more statistical data of TableScanning in ScanContext.
  • To distinguish between different stages of scanning files, set a ReadTag when creating DMFileReader.
  • An example:
mysql> explain analyze select max(ol_o_id) from order_line where ol_dist_info < '0Fvf5TLWcqdvYC2IeTcQjgMs';
+--------------------------------+------------+---------+--------------+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+------+
| id                             | estRows    | actRows | task         | access object    | execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | operator info                                                                                     | memory    | disk |
+--------------------------------+------------+---------+--------------+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+------+
| StreamAgg_10                   | 1.00       | 1       | root         |                  | time:772.7ms, loops:2, RU:455322.194336                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | funcs:max(tpcc.order_line.ol_o_id)->Column#12                                                     | 1.02 KB   | N/A  |
| └─TopN_13                      | 1.00       | 1       | root         |                  | time:772.7ms, loops:2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | tpcc.order_line.ol_o_id:desc, offset:0, count:1                                                   | 304 Bytes | N/A  |
|   └─TableReader_25             | 1.00       | 144     | root         |                  | time:772.7ms, loops:3, cop_task: {num: 146, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | MppVersion: 2, data:ExchangeSender_24                                                             | 571 Bytes | N/A  |
|     └─ExchangeSender_24        | 1.00       | 144     | mpp[tiflash] |                  | tiflash_task:{proc max:770.1ms, min:703.5ms, avg: 736.8ms, p80:770.1ms, p95:770.1ms, iters:144, tasks:2, threads:144}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | ExchangeType: PassThrough                                                                         | N/A       | N/A  |
|       └─TopN_23                | 1.00       | 144     | mpp[tiflash] |                  | tiflash_task:{proc max:769.1ms, min:702.5ms, avg: 735.8ms, p80:769.1ms, p95:769.1ms, iters:144, tasks:2, threads:144}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | tpcc.order_line.ol_o_id:desc, offset:0, count:1                                                   | N/A       | N/A  |
|         └─TableFullScan_21     | 5259869.34 | 2488186 | mpp[tiflash] | table:order_line | tiflash_task:{proc max:769.1ms, min:702.5ms, avg: 735.8ms, p80:769.1ms, p95:769.1ms, iters:9075, tasks:2, threads:144}, tiflash_scan:{dtfile:{data_scanned_rows:600039322, data_skipped_rows:1355266, mvcc_scanned_rows:551821000, mvcc_skipped_rows:1015522, lm_filter_scanned_rows:601394701, lm_filter_skipped_rows:0, rs_index_check_time: 21ms, read_time: 43143ms, disagg_cache_hit_size: 0, disagg_cache_miss_size: 0}, delta_rows: 259517, delta_bytes: 24654115, mvcc_input_rows: 539026105, mvcc_input_bytes: 9163443785, mvcc_output_rows: 539026105, lm_skip_rows: 1355379, segment_num: 775, create_snapshot_time: 2ms, build_bitmap_time: 44912ms, build_inputstream_time: 54915ms, local_min_stream_cost: 686ms, local_max_stream_cost: 760ms, remote_min_stream_cost: 0ms, remote_max_stream_cost: 0ms, local_region_num: 776, remote_region_num: 0, stale_read_num: 0, learner_read_time: 10ms, region_balance_info: {instance_num: 2, max/min: 396/380=1.042105}} | pushed down filter:lt(tpcc.order_line.ol_dist_info, "0Fvf5TLWcqdvYC2IeTcQjgMs"), keep order:false | N/A       | N/A  |
+--------------------------------+------------+---------+--------------+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+------+
6 rows in set (0.78 sec)

tiflash_scan:{
	dtfile:{
		data_scanned_rows:600039322, 
		data_skipped_rows:1355266, 
		mvcc_scanned_rows:551821000, 
		mvcc_skipped_rows:1015522, 
		lm_filter_scanned_rows:601394701, 
		lm_filter_skipped_rows:0, 
		rs_index_check_time: 21ms, 
		read_time: 43143ms, 
		disagg_cache_hit_size: 0, 
		disagg_cache_miss_size: 0
	}, 
	delta_rows: 259517, 
	delta_bytes: 24654115, 
	mvcc_input_rows: 539026105, 
	mvcc_input_bytes: 9163443785, 
	mvcc_output_rows: 539026105, 
	lm_skip_rows: 1355379, 
	segment_num: 775, 
	create_snapshot_time: 2ms, 
	build_bitmap_time: 44912ms, 
	build_inputstream_time: 54915ms, 
	local_min_stream_cost: 686ms, 
	local_max_stream_cost: 760ms, 
	remote_min_stream_cost: 0ms, 
	remote_max_stream_cost: 0ms, 
	local_region_num: 776, 
	remote_region_num: 0, 
	stale_read_num: 0, 
	learner_read_time: 10ms, 
	region_balance_info: {instance_num: 2, max/min: 396/380=1.042105}
}

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    • Use explain analyze to check the details of TableScanning.
  • 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

Improve the details shown in `explain analyze` execution info

@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 3, 2024
@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Apr 3, 2024
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/hold wait for tipb update

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2024
@JaySon-Huang JaySon-Huang changed the title [WIP] Storages: Add statistical data of TableScanning in ScanContext (release-7.5) Storages: Add statistical data of TableScanning in ScanContext (release-7.5) Apr 3, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 3, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Apr 12, 2024

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@JaySon-Huang
Copy link
Contributor Author

/hold cancel

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 7, 2024
@JaySon-Huang JaySon-Huang removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 7, 2024
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels May 7, 2024
@JaySon-Huang JaySon-Huang self-assigned this May 7, 2024
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

ti-chi-bot bot commented May 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JinheLin, Lloyd-Pottiger

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:
  • OWNERS [JinheLin,Lloyd-Pottiger]

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 May 8, 2024
Copy link
Contributor

ti-chi-bot bot commented May 8, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-07 10:05:52.64436157 +0000 UTC m=+956506.401497144: ☑️ agreed by Lloyd-Pottiger.
  • 2024-05-08 03:37:09.475874556 +0000 UTC m=+1019583.233010113: ☑️ agreed by JinheLin.

@ti-chi-bot ti-chi-bot bot merged commit a262839 into pingcap:release-7.5 May 8, 2024
5 checks passed
@JaySon-Huang JaySon-Huang deleted the scan_ctx_75 branch May 8, 2024 06:07
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 8, 2024
JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants