[Enhancement] Throttle scan to wait for topn filter (backport #55660) #55880
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(cherry picked from commit f86795b)
Why I'm doing:
High associative hash join is time-consuming, since it magnifies data volume many times. if there is a topn operator above it, then we can use this topn filter generated by topn operator to reduce input data volume of the hash join; however, when perform tests on this, the scan operator below hash join always transfers data to the hash join so fast that make the topn filter take effects on scan operator too late, so input data volume of the hash join is not reduced successfully, so we design a back pressure mechanism that works as follows:
Test
when topn filter back pressure mechanism is opened,data volume of left side of hash join is reduced to 1/60.
![image](https://private-user-images.githubusercontent.com/1721321/410801008-19598b26-7205-4ffa-8a47-ba162220b516.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjE3MDEsIm5iZiI6MTczOTYyMTQwMSwicGF0aCI6Ii8xNzIxMzIxLzQxMDgwMTAwOC0xOTU5OGIyNi03MjA1LTRmZmEtOGE0Ny1iYTE2MjIyMGI1MTYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTIxMDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjdiYzA1MGFlZmQ0MDE5YTZhNzQ2YWJkYWYyMGFjMTViMjBiYzUzZTM4NjczMGFkZjVlYzYyNThhMTdjNTRjMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.JNN5Cp-Advue24-rsvn-kP1gTaTUZsCA_KaNso5ZUPE)
when it is closed
![image](https://private-user-images.githubusercontent.com/1721321/410801195-aadb0d4e-1507-43b3-8512-c8c30035e7dd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjE3MDEsIm5iZiI6MTczOTYyMTQwMSwicGF0aCI6Ii8xNzIxMzIxLzQxMDgwMTE5NS1hYWRiMGQ0ZS0xNTA3LTQzYjMtODUxMi1jOGMzMDAzNWU3ZGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTIxMDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjJjMWJjNTMzNGI2OTEwYmU5OWViZWZlZjhlMzdlYjg5M2Y1OTA2NmIyOGVjNDUyYTkzMzEzMTA5OTI4ZDBkMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.77L4L5PcvK85C5sTTaP-_rSr6m0kE-QEjNFs6CvPRMY)
data volume of left side of hash join is reduced to 1/60.
disable opt means turn off the optimization;
enable opt(60ms) means turn on the optimization; and back_pressure_throttle_time_upper_bound=60, i.e. total throttle time does not exceeds 60ms.
What I'm doing:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist: