stmtsummary

package
v1.1.0-beta.0...-5637eaf Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterTableInstanceColumnNameStr = "INSTANCE"
	SummaryBeginTimeStr               = "SUMMARY_BEGIN_TIME"
	SummaryEndTimeStr                 = "SUMMARY_END_TIME"
	StmtTypeStr                       = "STMT_TYPE"
	SchemaNameStr                     = "SCHEMA_NAME"
	DigestStr                         = "DIGEST"
	DigestTextStr                     = "DIGEST_TEXT"
	TableNamesStr                     = "TABLE_NAMES"
	IndexNamesStr                     = "INDEX_NAMES"
	SampleUserStr                     = "SAMPLE_USER"
	ExecCountStr                      = "EXEC_COUNT"
	SumErrorsStr                      = "SUM_ERRORS"
	SumWarningsStr                    = "SUM_WARNINGS"
	SumLatencyStr                     = "SUM_LATENCY"
	MaxLatencyStr                     = "MAX_LATENCY"
	MinLatencyStr                     = "MIN_LATENCY"
	AvgLatencyStr                     = "AVG_LATENCY"
	AvgParseLatencyStr                = "AVG_PARSE_LATENCY"
	MaxParseLatencyStr                = "MAX_PARSE_LATENCY"
	AvgCompileLatencyStr              = "AVG_COMPILE_LATENCY"
	MaxCompileLatencyStr              = "MAX_COMPILE_LATENCY"
	SumCopTaskNumStr                  = "SUM_COP_TASK_NUM"
	MaxCopProcessTimeStr              = "MAX_COP_PROCESS_TIME"
	MaxCopProcessAddressStr           = "MAX_COP_PROCESS_ADDRESS"
	MaxCopWaitTimeStr                 = "MAX_COP_WAIT_TIME"    // #nosec G101
	MaxCopWaitAddressStr              = "MAX_COP_WAIT_ADDRESS" // #nosec G101
	AvgProcessTimeStr                 = "AVG_PROCESS_TIME"
	MaxProcessTimeStr                 = "MAX_PROCESS_TIME"
	AvgWaitTimeStr                    = "AVG_WAIT_TIME"
	MaxWaitTimeStr                    = "MAX_WAIT_TIME"
	AvgBackoffTimeStr                 = "AVG_BACKOFF_TIME"
	MaxBackoffTimeStr                 = "MAX_BACKOFF_TIME"
	AvgTotalKeysStr                   = "AVG_TOTAL_KEYS"
	MaxTotalKeysStr                   = "MAX_TOTAL_KEYS"
	AvgProcessedKeysStr               = "AVG_PROCESSED_KEYS"
	MaxProcessedKeysStr               = "MAX_PROCESSED_KEYS"
	AvgRocksdbDeleteSkippedCountStr   = "AVG_ROCKSDB_DELETE_SKIPPED_COUNT"
	MaxRocksdbDeleteSkippedCountStr   = "MAX_ROCKSDB_DELETE_SKIPPED_COUNT"
	AvgRocksdbKeySkippedCountStr      = "AVG_ROCKSDB_KEY_SKIPPED_COUNT"
	MaxRocksdbKeySkippedCountStr      = "MAX_ROCKSDB_KEY_SKIPPED_COUNT"
	AvgRocksdbBlockCacheHitCountStr   = "AVG_ROCKSDB_BLOCK_CACHE_HIT_COUNT"
	MaxRocksdbBlockCacheHitCountStr   = "MAX_ROCKSDB_BLOCK_CACHE_HIT_COUNT"
	AvgRocksdbBlockReadCountStr       = "AVG_ROCKSDB_BLOCK_READ_COUNT"
	MaxRocksdbBlockReadCountStr       = "MAX_ROCKSDB_BLOCK_READ_COUNT"
	AvgRocksdbBlockReadByteStr        = "AVG_ROCKSDB_BLOCK_READ_BYTE"
	MaxRocksdbBlockReadByteStr        = "MAX_ROCKSDB_BLOCK_READ_BYTE"
	AvgPrewriteTimeStr                = "AVG_PREWRITE_TIME"
	MaxPrewriteTimeStr                = "MAX_PREWRITE_TIME"
	AvgCommitTimeStr                  = "AVG_COMMIT_TIME"
	MaxCommitTimeStr                  = "MAX_COMMIT_TIME"
	AvgGetCommitTsTimeStr             = "AVG_GET_COMMIT_TS_TIME"
	MaxGetCommitTsTimeStr             = "MAX_GET_COMMIT_TS_TIME"
	AvgCommitBackoffTimeStr           = "AVG_COMMIT_BACKOFF_TIME"
	MaxCommitBackoffTimeStr           = "MAX_COMMIT_BACKOFF_TIME"
	AvgResolveLockTimeStr             = "AVG_RESOLVE_LOCK_TIME"
	MaxResolveLockTimeStr             = "MAX_RESOLVE_LOCK_TIME"
	AvgLocalLatchWaitTimeStr          = "AVG_LOCAL_LATCH_WAIT_TIME"
	MaxLocalLatchWaitTimeStr          = "MAX_LOCAL_LATCH_WAIT_TIME"
	AvgWriteKeysStr                   = "AVG_WRITE_KEYS"
	MaxWriteKeysStr                   = "MAX_WRITE_KEYS"
	AvgWriteSizeStr                   = "AVG_WRITE_SIZE"
	MaxWriteSizeStr                   = "MAX_WRITE_SIZE"
	AvgPrewriteRegionsStr             = "AVG_PREWRITE_REGIONS"
	MaxPrewriteRegionsStr             = "MAX_PREWRITE_REGIONS"
	AvgTxnRetryStr                    = "AVG_TXN_RETRY"
	MaxTxnRetryStr                    = "MAX_TXN_RETRY"
	SumExecRetryStr                   = "SUM_EXEC_RETRY"
	SumExecRetryTimeStr               = "SUM_EXEC_RETRY_TIME"
	SumBackoffTimesStr                = "SUM_BACKOFF_TIMES"
	BackoffTypesStr                   = "BACKOFF_TYPES"
	AvgMemStr                         = "AVG_MEM"
	MaxMemStr                         = "MAX_MEM"
	AvgDiskStr                        = "AVG_DISK"
	MaxDiskStr                        = "MAX_DISK"
	AvgKvTimeStr                      = "AVG_KV_TIME"
	AvgPdTimeStr                      = "AVG_PD_TIME"
	AvgBackoffTotalTimeStr            = "AVG_BACKOFF_TOTAL_TIME"
	AvgWriteSQLRespTimeStr            = "AVG_WRITE_SQL_RESP_TIME"
	AvgTidbCPUTimeStr                 = "AVG_TIDB_CPU_TIME"
	AvgTikvCPUTimeStr                 = "AVG_TIKV_CPU_TIME"
	MaxResultRowsStr                  = "MAX_RESULT_ROWS"
	MinResultRowsStr                  = "MIN_RESULT_ROWS"
	AvgResultRowsStr                  = "AVG_RESULT_ROWS"
	PreparedStr                       = "PREPARED"
	AvgAffectedRowsStr                = "AVG_AFFECTED_ROWS"
	FirstSeenStr                      = "FIRST_SEEN"
	LastSeenStr                       = "LAST_SEEN"
	PlanInCacheStr                    = "PLAN_IN_CACHE"
	PlanCacheHitsStr                  = "PLAN_CACHE_HITS"
	PlanCacheUnqualifiedStr           = "PLAN_CACHE_UNQUALIFIED"
	PlanCacheUnqualifiedLastReasonStr = "PLAN_CACHE_UNQUALIFIED_LAST_REASON"
	PlanInBindingStr                  = "PLAN_IN_BINDING"
	QuerySampleTextStr                = "QUERY_SAMPLE_TEXT"
	PrevSampleTextStr                 = "PREV_SAMPLE_TEXT"
	PlanDigestStr                     = "PLAN_DIGEST"
	PlanStr                           = "PLAN"
	BinaryPlan                        = "BINARY_PLAN"
	Charset                           = "CHARSET"
	Collation                         = "COLLATION"
	PlanHint                          = "PLAN_HINT"
	AvgRequestUnitRead                = "AVG_REQUEST_UNIT_READ"
	MaxRequestUnitRead                = "MAX_REQUEST_UNIT_READ"
	AvgRequestUnitWrite               = "AVG_REQUEST_UNIT_WRITE"
	MaxRequestUnitWrite               = "MAX_REQUEST_UNIT_WRITE"
	AvgQueuedRcTimeStr                = "AVG_QUEUED_RC_TIME"
	MaxQueuedRcTimeStr                = "MAX_QUEUED_RC_TIME"
	ResourceGroupName                 = "RESOURCE_GROUP"
)

Statements summary table column name.

Variables

View Source
var MaxEncodedPlanSizeInBytes = 1024 * 1024

MaxEncodedPlanSizeInBytes is the upper limit of the size of the plan and the binary plan in the stmt summary.

Functions

func Add

func Add(stmtExecInfo *stmtsummary.StmtExecInfo)

Add wraps GlobalStmtSummary.Add and stmtsummary.StmtSummaryByDigestMap.AddStatement.

func Close

func Close()

Close closes the GlobalStmtSummary.

func Enabled

func Enabled() bool

Enabled wraps GlobalStmtSummary.Enabled and stmtsummary.StmtSummaryByDigestMap.Enabled.

func EnabledInternal

func EnabledInternal() bool

EnabledInternal wraps GlobalStmtSummary.EnableInternalQuery and stmtsummary.StmtSummaryByDigestMap.EnabledInternal.

func GenerateStmtExecInfo4Test

func GenerateStmtExecInfo4Test(digest string) *stmtsummary.StmtExecInfo

GenerateStmtExecInfo4Test generates a new StmtExecInfo for testing purposes.

func GetMoreThanCntBindableStmt

func GetMoreThanCntBindableStmt(frequency int64) []*stmtsummary.BindableStmt

GetMoreThanCntBindableStmt wraps GlobalStmtSummary.GetMoreThanCntBindableStmt and stmtsummary.StmtSummaryByDigestMap.GetMoreThanCntBindableStmt.

func SetEnableInternalQuery

func SetEnableInternalQuery(v bool) error

SetEnableInternalQuery wraps GlobalStmtSummary.SetEnableInternalQuery and stmtsummary.StmtSummaryByDigestMap.SetEnabledInternalQuery.

func SetEnabled

func SetEnabled(v bool) error

SetEnabled wraps GlobalStmtSummary.SetEnabled and stmtsummary.StmtSummaryByDigestMap.SetEnabled.

func SetHistorySize

func SetHistorySize(v int) error

SetHistorySize wraps stmtsummary.StmtSummaryByDigestMap.SetHistorySize.

func SetMaxSQLLength

func SetMaxSQLLength(v int) error

SetMaxSQLLength wraps GlobalStmtSummary.SetMaxSQLLength and stmtsummary.StmtSummaryByDigestMap.SetMaxSQLLength.

func SetMaxStmtCount

func SetMaxStmtCount(v int) error

SetMaxStmtCount wraps GlobalStmtSummary.SetMaxStmtCount and stmtsummary.StmtSummaryByDigestMap.SetMaxStmtCount.

func SetRefreshInterval

func SetRefreshInterval(v int64) error

SetRefreshInterval wraps GlobalStmtSummary.SetRefreshInterval and stmtsummary.StmtSummaryByDigestMap.SetRefreshInterval.

func Setup

func Setup(cfg *Config) (err error)

Setup initializes the GlobalStmtSummary.

Types

type Config

type Config struct {
	Filename       string
	FileMaxSize    int
	FileMaxDays    int
	FileMaxBackups int
}

Config is the static configuration of StmtSummary. It cannot be modified at runtime.

type HistoryReader

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

HistoryReader is used to read data that has been persisted to files.

func NewHistoryReader

func NewHistoryReader(
	ctx context.Context,
	columns []*model.ColumnInfo,
	instanceAddr string,
	timeLocation *time.Location,
	user *auth.UserIdentity,
	hasProcessPriv bool,
	digests set.StringSet,
	timeRanges []*StmtTimeRange,
	concurrent int,
) (*HistoryReader, error)

NewHistoryReader creates a HisroryReader from StmtSummary and other necessary parameters. If timeRanges is present, only files within the time range will be read.

func (*HistoryReader) Close

func (r *HistoryReader) Close() error

Close ends reading and closes all files.

func (*HistoryReader) Rows

func (r *HistoryReader) Rows() ([][]types.Datum, error)

Rows returns rows converted from records in files. Reading and parsing works asynchronously. If (nil, nil) is returned, it means that the reading has been completed.

type MemReader

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

MemReader is used to read the current window's data maintained in memory by StmtSummary.

func NewMemReader

func NewMemReader(s *StmtSummary,
	columns []*model.ColumnInfo,
	instanceAddr string,
	timeLocation *time.Location,
	user *auth.UserIdentity,
	hasProcessPriv bool,
	digests set.StringSet,
	timeRanges []*StmtTimeRange) *MemReader

NewMemReader creates a MemReader from StmtSummary and other necessary parameters.

func (*MemReader) Rows

func (r *MemReader) Rows() [][]types.Datum

Rows returns rows converted from the current window's data maintained in memory by StmtSummary. All evicted data will be aggregated into a single row appended at the end.

type StmtRecord

type StmtRecord struct {
	// Each record is summarized between [Begin, End).
	Begin int64 `json:"begin"`
	End   int64 `json:"end"`
	// Immutable
	SchemaName    string `json:"schema_name"`
	Digest        string `json:"digest"`
	PlanDigest    string `json:"plan_digest"`
	StmtType      string `json:"stmt_type"`
	NormalizedSQL string `json:"normalized_sql"`
	TableNames    string `json:"table_names"`
	IsInternal    bool   `json:"is_internal"`
	// Basic
	SampleSQL        string   `json:"sample_sql"`
	Charset          string   `json:"charset"`
	Collation        string   `json:"collation"`
	PrevSQL          string   `json:"prev_sql"`
	SamplePlan       string   `json:"sample_plan"`
	SampleBinaryPlan string   `json:"sample_binary_plan"`
	PlanHint         string   `json:"plan_hint"`
	IndexNames       []string `json:"index_names"`
	ExecCount        int64    `json:"exec_count"`
	SumErrors        int      `json:"sum_errors"`
	SumWarnings      int      `json:"sum_warnings"`
	// Latency
	SumLatency        time.Duration `json:"sum_latency"`
	MaxLatency        time.Duration `json:"max_latency"`
	MinLatency        time.Duration `json:"min_latency"`
	SumParseLatency   time.Duration `json:"sum_parse_latency"`
	MaxParseLatency   time.Duration `json:"max_parse_latency"`
	SumCompileLatency time.Duration `json:"sum_compile_latency"`
	MaxCompileLatency time.Duration `json:"max_compile_latency"`
	// Coprocessor
	SumNumCopTasks       int64         `json:"sum_num_cop_tasks"`
	MaxCopProcessTime    time.Duration `json:"max_cop_process_time"`
	MaxCopProcessAddress string        `json:"max_cop_process_address"`
	MaxCopWaitTime       time.Duration `json:"max_cop_wait_time"`
	MaxCopWaitAddress    string        `json:"max_cop_wait_address"`
	// TiKV
	SumProcessTime               time.Duration `json:"sum_process_time"`
	MaxProcessTime               time.Duration `json:"max_process_time"`
	SumWaitTime                  time.Duration `json:"sum_wait_time"`
	MaxWaitTime                  time.Duration `json:"max_wait_time"`
	SumBackoffTime               time.Duration `json:"sum_backoff_time"`
	MaxBackoffTime               time.Duration `json:"max_backoff_time"`
	SumTotalKeys                 int64         `json:"sum_total_keys"`
	MaxTotalKeys                 int64         `json:"max_total_keys"`
	SumProcessedKeys             int64         `json:"sum_processed_keys"`
	MaxProcessedKeys             int64         `json:"max_processed_keys"`
	SumRocksdbDeleteSkippedCount uint64        `json:"sum_rocksdb_delete_skipped_count"`
	MaxRocksdbDeleteSkippedCount uint64        `json:"max_rocksdb_delete_skipped_count"`
	SumRocksdbKeySkippedCount    uint64        `json:"sum_rocksdb_key_skipped_count"`
	MaxRocksdbKeySkippedCount    uint64        `json:"max_rocksdb_key_skipped_count"`
	SumRocksdbBlockCacheHitCount uint64        `json:"sum_rocksdb_block_cache_hit_count"`
	MaxRocksdbBlockCacheHitCount uint64        `json:"max_rocksdb_block_cache_hit_count"`
	SumRocksdbBlockReadCount     uint64        `json:"sum_rocksdb_block_read_count"`
	MaxRocksdbBlockReadCount     uint64        `json:"max_rocksdb_block_read_count"`
	SumRocksdbBlockReadByte      uint64        `json:"sum_rocksdb_block_read_byte"`
	MaxRocksdbBlockReadByte      uint64        `json:"max_rocksdb_block_read_byte"`
	// Txn
	CommitCount          int64               `json:"commit_count"`
	SumGetCommitTsTime   time.Duration       `json:"sum_get_commit_ts_time"`
	MaxGetCommitTsTime   time.Duration       `json:"max_get_commit_ts_time"`
	SumPrewriteTime      time.Duration       `json:"sum_prewrite_time"`
	MaxPrewriteTime      time.Duration       `json:"max_prewrite_time"`
	SumCommitTime        time.Duration       `json:"sum_commit_time"`
	MaxCommitTime        time.Duration       `json:"max_commit_time"`
	SumLocalLatchTime    time.Duration       `json:"sum_local_latch_time"`
	MaxLocalLatchTime    time.Duration       `json:"max_local_latch_time"`
	SumCommitBackoffTime int64               `json:"sum_commit_backoff_time"`
	MaxCommitBackoffTime int64               `json:"max_commit_backoff_time"`
	SumResolveLockTime   int64               `json:"sum_resolve_lock_time"`
	MaxResolveLockTime   int64               `json:"max_resolve_lock_time"`
	SumWriteKeys         int64               `json:"sum_write_keys"`
	MaxWriteKeys         int                 `json:"max_write_keys"`
	SumWriteSize         int64               `json:"sum_write_size"`
	MaxWriteSize         int                 `json:"max_write_size"`
	SumPrewriteRegionNum int64               `json:"sum_prewrite_region_num"`
	MaxPrewriteRegionNum int32               `json:"max_prewrite_region_num"`
	SumTxnRetry          int64               `json:"sum_txn_retry"`
	MaxTxnRetry          int                 `json:"max_txn_retry"`
	SumBackoffTimes      int64               `json:"sum_backoff_times"`
	BackoffTypes         map[string]int      `json:"backoff_types"`
	AuthUsers            map[string]struct{} `json:"auth_users"`
	// Other
	SumMem               int64         `json:"sum_mem"`
	MaxMem               int64         `json:"max_mem"`
	SumDisk              int64         `json:"sum_disk"`
	MaxDisk              int64         `json:"max_disk"`
	SumAffectedRows      uint64        `json:"sum_affected_rows"`
	SumKVTotal           time.Duration `json:"sum_kv_total"`
	SumPDTotal           time.Duration `json:"sum_pd_total"`
	SumBackoffTotal      time.Duration `json:"sum_backoff_total"`
	SumWriteSQLRespTotal time.Duration `json:"sum_write_sql_resp_total"`
	SumTidbCPU           time.Duration `json:"sum_tidb_cpu"`
	SumTikvCPU           time.Duration `json:"sum_tikv_cpu"`
	SumResultRows        int64         `json:"sum_result_rows"`
	MaxResultRows        int64         `json:"max_result_rows"`
	MinResultRows        int64         `json:"min_result_rows"`
	Prepared             bool          `json:"prepared"`
	// The first time this type of SQL executes.
	FirstSeen time.Time `json:"first_seen"`
	// The last time this type of SQL executes.
	LastSeen time.Time `json:"last_seen"`
	// Plan cache
	PlanInCache   bool  `json:"plan_in_cache"`
	PlanCacheHits int64 `json:"plan_cache_hits"`
	PlanInBinding bool  `json:"plan_in_binding"`
	// Pessimistic execution retry information.
	ExecRetryCount uint          `json:"exec_retry_count"`
	ExecRetryTime  time.Duration `json:"exec_retry_time"`

	KeyspaceName string `json:"keyspace_name,omitempty"`
	KeyspaceID   uint32 `json:"keyspace_id,omitempty"`
	// request units(RU)
	ResourceGroupName string `json:"resource_group_name"`
	stmtsummary.StmtRUSummary

	PlanCacheUnqualifiedCount      int64  `json:"plan_cache_unqualified_count"`
	PlanCacheUnqualifiedLastReason string `json:"plan_cache_unqualified_last_reason"` // the reason why this query is unqualified for the plan cache
}

StmtRecord represents a statement statistics record. StmtRecord is addable and mergable.

func NewStmtRecord

func NewStmtRecord(info *stmtsummary.StmtExecInfo) *StmtRecord

NewStmtRecord creates a new StmtRecord from StmtExecInfo. StmtExecInfo is only used to initialize the basic information of StmtRecord. Next we need to call StmtRecord.Add to add the statistics of the StmtExecInfo into the StmtRecord.

func (*StmtRecord) Add

func (r *StmtRecord) Add(info *stmtsummary.StmtExecInfo)

Add adds the statistics of StmtExecInfo to StmtRecord.

func (*StmtRecord) Merge

func (r *StmtRecord) Merge(other *StmtRecord)

Merge merges the statistics of another StmtRecord to this StmtRecord.

type StmtSummary

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

StmtSummary represents the complete statements summary statistics. It controls data rotation and persistence internally, and provides reading interface through MemReader and HistoryReader.

var (
	// GlobalStmtSummary is the global StmtSummary instance, we need
	// to explicitly call Setup() to initialize it. It will then be
	// referenced by SessionVars.StmtSummary for each session.
	GlobalStmtSummary *StmtSummary
)

func NewStmtSummary

func NewStmtSummary(cfg *Config) (*StmtSummary, error)

NewStmtSummary creates a new StmtSummary from Config.

func NewStmtSummary4Test

func NewStmtSummary4Test(maxStmtCount uint) *StmtSummary

NewStmtSummary4Test creates a new StmtSummary for testing purposes.

func (*StmtSummary) Add

func (s *StmtSummary) Add(info *stmtsummary.StmtExecInfo)

Add adds a single stmtsummary.StmtExecInfo to the current statistics window of StmtSummary. Before adding, it will check whether the current window has expired, and if it has expired, the window will be persisted asynchronously and a new window will be created to replace the current one.

func (*StmtSummary) Clear

func (s *StmtSummary) Clear()

Clear clears all data in the current window, and the data that has been persisted will not be cleared.

func (*StmtSummary) ClearInternal

func (s *StmtSummary) ClearInternal()

ClearInternal clears all internal queries of the current window, and the data that has been persisted will not be cleared.

func (*StmtSummary) Close

func (s *StmtSummary) Close()

Close closes the work of StmtSummary.

func (*StmtSummary) EnableInternalQuery

func (s *StmtSummary) EnableInternalQuery() bool

EnableInternalQuery returns whether the StmtSummary counts internal queries.

func (*StmtSummary) Enabled

func (s *StmtSummary) Enabled() bool

Enabled returns whether the StmtSummary is enabled.

func (*StmtSummary) Evicted

func (s *StmtSummary) Evicted() []types.Datum

Evicted returns the number of statements evicted for the current time window. The returned type is one row consisting of three columns: [BEGIN_TIME, END_TIME, EVICTED_COUNT].

func (*StmtSummary) GetMoreThanCntBindableStmt

func (s *StmtSummary) GetMoreThanCntBindableStmt(cnt int64) []*stmtsummary.BindableStmt

GetMoreThanCntBindableStmt is used to get bindable statements. Statements whose execution times exceed the threshold will be returned. Since the historical data has been persisted, we only refer to the statistics data of the current window in memory.

func (*StmtSummary) MaxSQLLength

func (s *StmtSummary) MaxSQLLength() uint32

MaxSQLLength returns the maximum size of a single SQL statement.

func (*StmtSummary) MaxStmtCount

func (s *StmtSummary) MaxStmtCount() uint32

MaxStmtCount returns the maximum number of statements.

func (*StmtSummary) RefreshInterval

func (s *StmtSummary) RefreshInterval() uint32

RefreshInterval returns the period (in seconds) at which the statistics window is refreshed (persisted).

func (*StmtSummary) SetEnableInternalQuery

func (s *StmtSummary) SetEnableInternalQuery(v bool) error

SetEnableInternalQuery is used to enable or disable StmtSummary's internal query statistics. If disabled, in-memory internal queries will be cleared, (persisted internal queries will still be remained).

func (*StmtSummary) SetEnabled

func (s *StmtSummary) SetEnabled(v bool) error

SetEnabled is used to enable or disable StmtSummary. If disabled, in-memory data will be cleared, (persisted data will still be remained).

func (*StmtSummary) SetMaxSQLLength

func (s *StmtSummary) SetMaxSQLLength(v uint32) error

SetMaxSQLLength sets the maximum size of a single SQL statement.

func (*StmtSummary) SetMaxStmtCount

func (s *StmtSummary) SetMaxStmtCount(v uint32) error

SetMaxStmtCount is used to set the maximum number of statements. If the current number exceeds the maximum number, the excess will be evicted.

func (*StmtSummary) SetRefreshInterval

func (s *StmtSummary) SetRefreshInterval(v uint32) error

SetRefreshInterval sets the period (in seconds) for the statistics window to be refreshed (persisted). This may trigger a refresh (persistence) of the current statistics window early.

type StmtTimeRange

type StmtTimeRange struct {
	Begin int64
	End   int64
}

StmtTimeRange is the time range type used in the stmtsummary package. [Begin, End)

Jump to

Keyboard shortcuts

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