Documentation
¶
Index ¶
- func ReadBinding(ctx context.Context, db *sql.DB) (map[string]Binding, error)
- func ReadStmtSummary(ctx context.Context, db *sql.DB, outCh chan<- *StmtSummary) error
- func ReadTableStats(ctx context.Context, client *http.Client, addr string, schema, table string) (string, error)
- type Binding
- type StmtSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadBinding ¶
ReadBinding reads all enabled binding information from the TiDB cluster and use a map of SQL digest to Binding to represent them.
func ReadStmtSummary ¶
ReadStmtSummary reads the statement summary from the TiDB cluster. It emits the StmtSummary one by one into `outCh`, or return error. When work is completed, it will return nil. In any cases it will not close the channel.
TODO(lance6716): can use statements_summary_evicted to calculate confidence TODO(lance6716): query CLUSTER_STATEMENTS_SUMMARY to get real time data
Types ¶
type StmtSummary ¶
type StmtSummary struct {
// fields from the table
Schema string
SQL string
TableNamesNeedToSync [][2]string
PlanStr string
SQLDigest string
PlanDigest string
ExecCount int
SumLatency time.Duration
Instance string
SummaryBeginTime time.Time
PlanInBinding bool
// computed fields
HasParseError bool
BindingDigest string
Binding Binding
}
StmtSummary represents one record in INFORMATION_SCHEMA.CLUSTER_STATEMENTS_SUMMARY_HISTORY. The Instance + SummaryBeginTime + SQLDigest + PlanDigest fields are used as the ID of the StmtSummary.