workloadbasedlearning

package
v1.1.0-beta.0...-c329b22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package workloadbasedlearning implements the Workload-Based Learning Optimizer. The Workload-Based Learning Optimizer introduces a new module in TiDB that leverages captured workload history to enhance the database query optimizer. By learning from historical data, this module helps the optimizer make smarter decisions, such as identify hot and cold tables, analyze resource consumption, etc. The workload analysis results can be used to directly suggest a better path, or to indirectly influence the cost model and stats so that the optimizer can select the best plan more intelligently and adaptively.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle struct {
}

Handle The entry point for all workload-based learning related tasks

func NewWorkloadBasedLearningHandle

func NewWorkloadBasedLearningHandle() *Handle

NewWorkloadBasedLearningHandle Create a new WorkloadBasedLearningHandle WorkloadBasedLearningHandle is Singleton pattern

func (*Handle) HandleReadTableCost

func (handle *Handle) HandleReadTableCost()

HandleReadTableCost Start a new round of analysis of all historical read queries. According to abstracted table cost metrics, calculate the percentage of read scan time and memory usage for each table. The result will be saved to the table "mysql.workload_values". Dataflow

  1. Abstract middle table cost metrics(scan time, memory usage, read frequency) from every record in statement_summary/statement_stats

2,3. Group by tablename, get the total scan time, total memory usage, and every table scan time, memory usage,

read frequency

4. Calculate table cost for each table, table cost = table scan time / total scan time + table mem usage / total mem usage 5. Save all table cost metrics[per table](scan time, table cost, etc) to table "mysql.workload_values"

type ReadTableCostMetrics

type ReadTableCostMetrics struct {
	// contains filtered or unexported fields
}

ReadTableCostMetrics is used to indicate the intermediate status and results analyzed through read workload for function "HandleReadTableCost".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL