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

Support runtime stats for tiflash #9904

Open
guo-shaoge opened this issue Feb 24, 2025 · 0 comments
Open

Support runtime stats for tiflash #9904

guo-shaoge opened this issue Feb 24, 2025 · 0 comments
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@guo-shaoge
Copy link
Contributor

guo-shaoge commented Feb 24, 2025

Enhancement

Runtime stats refer to recording the characteristics of a query during execution, and using these statistics to select a more optimal execution strategy the next time the same query runs. Typical runtime stats include:

  1. Record the average length of the key for HashAgg on key_string. Based on this length, an appropriate HashTable can be chosen. For example, if the average length is greater than 24B, a regular HashTable is used; otherwise, a StringHashTable is selected (by using norma HashTable, we can support prefetch. because StringHashMap doesn't support prefetch) (major, 10%).
  2. Whether the query last used a two-level HashMap for HashAgg. If so, the two-level HashMap can be used directly in the next execution, saving the time of converting from one-level to two-level. (minor, <=5%)
  3. Based on the size of the HashTable in HashAgg, an early resize may be performed (though this is harder to implement in TiFlash, as the region selected for a query may change due to load balancing strategies).
  4. The reserve size for ColumnString. By default, it is assumed that the string length is 64B. If more accurate information becomes available later, it will improve the expression evaluation. (minor, <=5%)
  5. When the NDV (Number of Distinct Values) in HashAgg is very low, using mini-batch may have side effects. Through runtime stats, the non-mini-batch version can be proactively chosen for the next query execution. (minor, <= 5%)
@guo-shaoge guo-shaoge added the type/enhancement The issue or PR belongs to an enhancement. label Feb 24, 2025
@guo-shaoge guo-shaoge self-assigned this Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant