Documentation ¶
Index ¶
- Constants
- Variables
- func BoolToOnOff(b bool) string
- func CheckSysVarIsRemoved(varName string) error
- func GetDDLErrorCountLimit() int64
- func GetDDLFlashbackConcurrency() int32
- func GetDDLReorgBatchSize() int32
- func GetDDLReorgRowFormat() int64
- func GetDDLReorgWorkerCounter() int32
- func GetMaxDeltaSchemaCount() int64
- func GetStatusVars(vars *SessionVars) (map[string]*StatusVal, error)
- func GetSysVars() map[string]*SysVar
- func IsAdaptiveReplicaReadEnabled() bool
- func IsRemovedSysVar(varName string) bool
- func OnOffToTrueFalse(str string) string
- func RegisterStatistics(s Statistics)
- func RegisterSysVar(sv *SysVar)
- func SetDDLErrorCountLimit(cnt int64)
- func SetDDLFlashbackConcurrency(cnt int32)
- func SetDDLReorgBatchSize(cnt int32)
- func SetDDLReorgRowFormat(format int64)
- func SetDDLReorgWorkerCounter(cnt int32)
- func SetEnableAdaptiveReplicaRead(enabled bool) bool
- func SetMaxDeltaSchemaCount(cnt int64)
- func SetSysVar(name string, value string)
- func TiDBOptOn(opt string) bool
- func TiDBOptOnOffWarn(opt string) int
- func TidbOptInt(opt string, defaultVal int) int
- func TidbOptInt64(opt string, defaultVal int64) int64
- func TidbOptUint64(opt string, defaultVal uint64) uint64
- func UnregisterStatistics(s Statistics)
- func UnregisterSysVar(name string)
- type AssertionLevel
- type BatchSize
- type ClusteredIndexDefMode
- type Concurrency
- func (c *Concurrency) DistSQLScanConcurrency() int
- func (c *Concurrency) HashAggFinalConcurrency() int
- func (c *Concurrency) HashAggPartialConcurrency() int
- func (c *Concurrency) HashJoinConcurrency() int
- func (c *Concurrency) IndexLookupConcurrency() int
- func (c *Concurrency) IndexLookupJoinConcurrency() int
- func (c *Concurrency) IndexMergeIntersectionConcurrency() int
- func (c *Concurrency) IndexSerialScanConcurrency() int
- func (c *Concurrency) MergeJoinConcurrency() int
- func (c *Concurrency) ProjectionConcurrency() int
- func (c *Concurrency) SetDistSQLScanConcurrency(n int)
- func (c *Concurrency) SetHashAggFinalConcurrency(n int)
- func (c *Concurrency) SetHashAggPartialConcurrency(n int)
- func (c *Concurrency) SetHashJoinConcurrency(n int)
- func (c *Concurrency) SetIndexLookupConcurrency(n int)
- func (c *Concurrency) SetIndexLookupJoinConcurrency(n int)
- func (c *Concurrency) SetIndexMergeIntersectionConcurrency(n int)
- func (c *Concurrency) SetIndexSerialScanConcurrency(n int)
- func (c *Concurrency) SetMergeJoinConcurrency(n int)
- func (c *Concurrency) SetProjectionConcurrency(n int)
- func (c *Concurrency) SetStreamAggConcurrency(n int)
- func (c *Concurrency) SetWindowConcurrency(n int)
- func (c *Concurrency) StreamAggConcurrency() int
- func (c *Concurrency) UnionConcurrency() int
- func (c *Concurrency) WindowConcurrency() int
- type ConnectionInfo
- type GlobalVarAccessor
- type HookContext
- type JSONSQLWarnForSlowLog
- type MemQuota
- type MockGlobalAccessor
- func (m *MockGlobalAccessor) GetGlobalSysVar(name string) (string, error)
- func (m *MockGlobalAccessor) GetTiDBTableValue(name string) (string, error)
- func (m *MockGlobalAccessor) SetGlobalSysVar(ctx context.Context, name string, value string) (err error)
- func (m *MockGlobalAccessor) SetGlobalSysVarOnly(ctx context.Context, name string, value string, _ bool) error
- func (m *MockGlobalAccessor) SetTiDBTableValue(name, value, comment string) error
- type PartitionPruneMode
- type PreparedParams
- type ReadConsistencyLevel
- type RetryInfo
- type ReuseChunkPool
- type RewritePhaseInfo
- type SavepointRecord
- type ScopeFlag
- type SequenceState
- type SessionVars
- func (s *SessionVars) AddNonPreparedPlanCacheStmt(sql string, stmt interface{})
- func (s *SessionVars) AddPlanReplayerFinishedTaskKey(key replayer.PlanReplayerTaskKey)
- func (s *SessionVars) AddPreparedStmt(stmtID uint32, stmt interface{}) error
- func (s *SessionVars) AllocNewPlanID() int
- func (s *SessionVars) AllocPlanColumnID() int64
- func (s *SessionVars) BuildParserConfig() parser.ParserConfig
- func (s *SessionVars) CheckAndGetTxnScope() string
- func (s *SessionVars) CheckPlanReplayerFinishedTaskKey(key replayer.PlanReplayerTaskKey) bool
- func (s *SessionVars) CleanBuffers()
- func (s *SessionVars) CleanupTxnReadTSIfUsed()
- func (s *SessionVars) ClearAlloc(alloc *chunk.Allocator, b bool)
- func (s *SessionVars) ClearStmtVars()
- func (s *SessionVars) DecodeSessionStates(ctx context.Context, sessionStates *sessionstates.SessionStates) (err error)
- func (s *SessionVars) EnableEvalTopNEstimationForStrMatch() bool
- func (s *SessionVars) EnableForceInlineCTE() bool
- func (s *SessionVars) EncodeSessionStates(ctx context.Context, sessionStates *sessionstates.SessionStates) (err error)
- func (s *SessionVars) ExchangeChunkStatus()
- func (s *SessionVars) GetAllowInSubqToJoinAndAgg() bool
- func (s *SessionVars) GetAllowPreferRangeScan() bool
- func (s *SessionVars) GetCPUFactor() float64
- func (s *SessionVars) GetCharsetInfo() (charset, collation string)
- func (s *SessionVars) GetConcurrencyFactor() float64
- func (s *SessionVars) GetCopCPUFactor() float64
- func (s *SessionVars) GetCurrentShard(count int) int64
- func (s *SessionVars) GetDescScanFactor(tbl *model.TableInfo) float64
- func (s *SessionVars) GetDiskFactor() float64
- func (s *SessionVars) GetEnableCascadesPlanner() bool
- func (s *SessionVars) GetEnableIndexMerge() bool
- func (s *SessionVars) GetEnablePseudoForOutdatedStats() bool
- func (s *SessionVars) GetGlobalSystemVar(ctx context.Context, name string) (string, error)
- func (s *SessionVars) GetIsolationReadEngines() map[kv.StoreType]struct{}
- func (s *SessionVars) GetMemoryFactor() float64
- func (s *SessionVars) GetNegateStrMatchDefaultSelectivity() float64
- func (s *SessionVars) GetNetworkFactor(tbl *model.TableInfo) float64
- func (s *SessionVars) GetNewChunkWithCapacity(fields []*types.FieldType, capacity int, maxCachesize int, ...) *chunk.Chunk
- func (s *SessionVars) GetNextPreparedStmtID() uint32
- func (s *SessionVars) GetNonPreparedPlanCacheStmt(sql string) interface{}
- func (s *SessionVars) GetParseParams() []parser.ParseParam
- func (s *SessionVars) GetPreparedStmtByID(stmtID uint32) (interface{}, error)
- func (s *SessionVars) GetPreparedStmtByName(stmtName string) (interface{}, error)
- func (s *SessionVars) GetPrevStmtDigest() string
- func (s *SessionVars) GetReadableTxnMode() string
- func (s *SessionVars) GetRelatedTableForMDL() *sync.Map
- func (s *SessionVars) GetReplicaRead() kv.ReplicaReadType
- func (s *SessionVars) GetScanFactor(tbl *model.TableInfo) float64
- func (s *SessionVars) GetSeekFactor(tbl *model.TableInfo) float64
- func (s *SessionVars) GetSessionOrGlobalSystemVar(ctx context.Context, name string) (string, error)
- func (s *SessionVars) GetSessionStatesSystemVar(name string) (string, bool, error)
- func (s *SessionVars) GetSplitRegionTimeout() time.Duration
- func (s *SessionVars) GetStatusFlag(flag uint16) bool
- func (s *SessionVars) GetStrMatchDefaultSelectivity() float64
- func (s *SessionVars) GetSystemVar(name string) (string, bool)
- func (s *SessionVars) GetTemporaryTable(tblInfo *model.TableInfo) tableutil.TempTable
- func (s *SessionVars) GetUseChunkAlloc() bool
- func (s *SessionVars) GetUserVarType(name string) (*types.FieldType, bool)
- func (s *SessionVars) GetUserVarVal(name string) (types.Datum, bool)
- func (s *SessionVars) GetWriteStmtBufs() *WriteStmtBufs
- func (s *SessionVars) InTxn() bool
- func (s *SessionVars) InitStatementContext() *stmtctx.StatementContext
- func (s *SessionVars) IsAutocommit() bool
- func (s *SessionVars) IsDynamicPartitionPruneEnabled() bool
- func (s *SessionVars) IsIsolation(isolation string) bool
- func (s *SessionVars) IsMPPAllowed() bool
- func (s *SessionVars) IsMPPEnforced() bool
- func (s *SessionVars) IsPessimisticReadConsistency() bool
- func (s *SessionVars) IsPlanReplayerCaptureEnabled() bool
- func (s *SessionVars) IsReplicaReadClosestAdaptive() bool
- func (s *SessionVars) IsolationLevelForNewTxn() (isolation string)
- func (s *SessionVars) LazyCheckKeyNotExists() bool
- func (s *SessionVars) Location() *time.Location
- func (s *SessionVars) RaiseWarningWhenMPPEnforced(warning string)
- func (s *SessionVars) RemovePreparedStmt(stmtID uint32)
- func (s *SessionVars) SetAlloc(alloc chunk.Allocator)
- func (s *SessionVars) SetAllowInSubqToJoinAndAgg(val bool)
- func (s *SessionVars) SetAllowPreferRangeScan(val bool)
- func (s *SessionVars) SetEnableCascadesPlanner(val bool)
- func (s *SessionVars) SetEnableIndexMerge(val bool)
- func (s *SessionVars) SetEnablePseudoForOutdatedStats(val bool)
- func (s *SessionVars) SetInTxn(val bool)
- func (s *SessionVars) SetLastInsertID(insertID uint64)
- func (s *SessionVars) SetNextPreparedStmtID(preparedStmtID uint32)
- func (s *SessionVars) SetPrevStmtDigest(prevStmtDigest string)
- func (s *SessionVars) SetReplicaRead(val kv.ReplicaReadType)
- func (s *SessionVars) SetStatusFlag(flag uint16, on bool)
- func (s *SessionVars) SetStmtVar(name string, value string) error
- func (s *SessionVars) SetStringUserVar(name string, strVal string, collation string)
- func (s *SessionVars) SetSystemVar(name string, val string) error
- func (s *SessionVars) SetSystemVarWithRelaxedValidation(name string, val string) error
- func (s *SessionVars) SetSystemVarWithoutValidation(name string, val string) error
- func (s *SessionVars) SetTxnIsolationLevelOneShotStateForNextTxn()
- func (s *SessionVars) SetUserVarType(name string, ft *types.FieldType)
- func (s *SessionVars) SetUserVarVal(name string, dt types.Datum)
- func (s *SessionVars) SlowLogFormat(logItems *SlowQueryLogItems) string
- func (s *SessionVars) UnsetUserVar(varName string)
- func (s *SessionVars) WithdrawAllPreparedStmt()
- type SlowQueryLogItems
- type Statistics
- type StatusVal
- type SysVar
- func (sv *SysVar) GetGlobalFromHook(ctx context.Context, s *SessionVars) (string, error)
- func (sv *SysVar) GetNativeValType(val string) (types.Datum, byte, uint)
- func (sv *SysVar) GetSessionFromHook(s *SessionVars) (string, error)
- func (sv *SysVar) HasGlobalScope() bool
- func (sv *SysVar) HasInstanceScope() bool
- func (sv *SysVar) HasNoneScope() bool
- func (sv *SysVar) HasSessionScope() bool
- func (sv *SysVar) SetGlobalFromHook(ctx context.Context, s *SessionVars, val string, skipAliases bool) error
- func (sv *SysVar) SetSessionFromHook(s *SessionVars, val string) error
- func (sv *SysVar) SkipInit() bool
- func (sv *SysVar) SkipSysvarCache() bool
- func (sv *SysVar) Validate(vars *SessionVars, value string, scope ScopeFlag) (string, error)
- func (sv *SysVar) ValidateFromType(vars *SessionVars, value string, scope ScopeFlag) (string, error)
- func (sv *SysVar) ValidateWithRelaxedValidation(vars *SessionVars, value string, scope ScopeFlag) string
- type TableDelta
- type TableSnapshot
- type TemporaryTableData
- type TransactionContext
- func (tc *TransactionContext) AddSavepoint(name string, memdbCheckpoint *tikv.MemDBCheckpoint)
- func (tc *TransactionContext) AddUnchangedRowKey(key []byte)
- func (tc *TransactionContext) Cleanup()
- func (tc *TransactionContext) ClearDelta()
- func (tc *TransactionContext) CollectUnchangedRowKeys(buf []kv.Key) []kv.Key
- func (tc *TransactionContext) DeleteSavepoint(name string) bool
- func (tc *TransactionContext) GetCurrentSavepoint() TxnCtxNeedToRestore
- func (tc *TransactionContext) GetForUpdateTS() uint64
- func (tc *TransactionContext) GetKeyInPessimisticLockCache(key kv.Key) (val []byte, ok bool)
- func (tc *TransactionContext) ReleaseSavepoint(name string) bool
- func (tc *TransactionContext) RestoreBySavepoint(savepoint TxnCtxNeedToRestore)
- func (tc *TransactionContext) RollbackToSavepoint(name string) *SavepointRecord
- func (tc *TransactionContext) SetForUpdateTS(forUpdateTS uint64)
- func (tc *TransactionContext) SetPessimisticLockCache(key kv.Key, val []byte)
- func (tc *TransactionContext) UpdateDeltaForTable(physicalTableID int64, delta int64, count int64, colSize map[int64]int64)
- type TxnCtxNeedToRestore
- type TxnCtxNoNeedToRestore
- type TxnReadTS
- type TypeFlag
- type WriteStmtBufs
Constants ¶
const ( // PlacementModeStrict indicates all placement operations should be checked strictly in ddl PlacementModeStrict string = "STRICT" // PlacementModeIgnore indicates ignore all placement operations in ddl PlacementModeIgnore string = "IGNORE" )
const ( // ConnTypeSocket indicates socket without TLS. ConnTypeSocket string = "Socket" // ConnTypeUnixSocket indicates Unix Socket. ConnTypeUnixSocket string = "UnixSocket" // ConnTypeTLS indicates socket with TLS. ConnTypeTLS string = "SSL/TLS" )
const ( // SlowLogRowPrefixStr is slow log row prefix. SlowLogRowPrefixStr = "# " // SlowLogSpaceMarkStr is slow log space mark. SlowLogSpaceMarkStr = ": " // SlowLogSQLSuffixStr is slow log suffix. SlowLogSQLSuffixStr = ";" // SlowLogTimeStr is slow log field name. SlowLogTimeStr = "Time" // SlowLogStartPrefixStr is slow log start row prefix. SlowLogStartPrefixStr = SlowLogRowPrefixStr + SlowLogTimeStr + SlowLogSpaceMarkStr // SlowLogTxnStartTSStr is slow log field name. SlowLogTxnStartTSStr = "Txn_start_ts" // SlowLogUserAndHostStr is the user and host field name, which is compatible with MySQL. SlowLogUserAndHostStr = "User@Host" // SlowLogUserStr is slow log field name. SlowLogUserStr = "User" // SlowLogHostStr only for slow_query table usage. SlowLogHostStr = "Host" // SlowLogConnIDStr is slow log field name. SlowLogConnIDStr = "Conn_ID" // SlowLogQueryTimeStr is slow log field name. SlowLogQueryTimeStr = "Query_time" // SlowLogParseTimeStr is the parse sql time. SlowLogParseTimeStr = "Parse_time" // SlowLogCompileTimeStr is the compile plan time. SlowLogCompileTimeStr = "Compile_time" // SlowLogRewriteTimeStr is the rewrite time. SlowLogRewriteTimeStr = "Rewrite_time" // SlowLogOptimizeTimeStr is the optimization time. SlowLogOptimizeTimeStr = "Optimize_time" // SlowLogWaitTSTimeStr is the time of waiting TS. SlowLogWaitTSTimeStr = "Wait_TS" // SlowLogPreprocSubQueriesStr is the number of pre-processed sub-queries. SlowLogPreprocSubQueriesStr = "Preproc_subqueries" // SlowLogPreProcSubQueryTimeStr is the total time of pre-processing sub-queries. SlowLogPreProcSubQueryTimeStr = "Preproc_subqueries_time" // SlowLogDBStr is slow log field name. SlowLogDBStr = "DB" // SlowLogIsInternalStr is slow log field name. SlowLogIsInternalStr = "Is_internal" // SlowLogIndexNamesStr is slow log field name. SlowLogIndexNamesStr = "Index_names" // SlowLogDigestStr is slow log field name. SlowLogDigestStr = "Digest" // SlowLogQuerySQLStr is slow log field name. SlowLogQuerySQLStr = "Query" // use for slow log table, slow log will not print this field name but print sql directly. // SlowLogStatsInfoStr is plan stats info. SlowLogStatsInfoStr = "Stats" // SlowLogNumCopTasksStr is the number of cop-tasks. SlowLogNumCopTasksStr = "Num_cop_tasks" // SlowLogCopProcAvg is the average process time of all cop-tasks. SlowLogCopProcAvg = "Cop_proc_avg" // SlowLogCopProcP90 is the p90 process time of all cop-tasks. SlowLogCopProcP90 = "Cop_proc_p90" // SlowLogCopProcMax is the max process time of all cop-tasks. SlowLogCopProcMax = "Cop_proc_max" // SlowLogCopProcAddr is the address of TiKV where the cop-task which cost max process time run. SlowLogCopProcAddr = "Cop_proc_addr" // SlowLogCopWaitAvg is the average wait time of all cop-tasks. SlowLogCopWaitAvg = "Cop_wait_avg" // #nosec G101 // SlowLogCopWaitP90 is the p90 wait time of all cop-tasks. SlowLogCopWaitP90 = "Cop_wait_p90" // #nosec G101 // SlowLogCopWaitMax is the max wait time of all cop-tasks. SlowLogCopWaitMax = "Cop_wait_max" // SlowLogCopWaitAddr is the address of TiKV where the cop-task which cost wait process time run. SlowLogCopWaitAddr = "Cop_wait_addr" // #nosec G101 // SlowLogCopBackoffPrefix contains backoff information. SlowLogCopBackoffPrefix = "Cop_backoff_" // SlowLogMemMax is the max number bytes of memory used in this statement. SlowLogMemMax = "Mem_max" // SlowLogDiskMax is the nax number bytes of disk used in this statement. SlowLogDiskMax = "Disk_max" // SlowLogPrepared is used to indicate whether this sql execute in prepare. SlowLogPrepared = "Prepared" // SlowLogPlanFromCache is used to indicate whether this plan is from plan cache. SlowLogPlanFromCache = "Plan_from_cache" // SlowLogPlanFromBinding is used to indicate whether this plan is matched with the hints in the binding. SlowLogPlanFromBinding = "Plan_from_binding" // SlowLogHasMoreResults is used to indicate whether this sql has more following results. SlowLogHasMoreResults = "Has_more_results" // SlowLogSucc is used to indicate whether this sql execute successfully. SlowLogSucc = "Succ" // SlowLogPrevStmt is used to show the previous executed statement. SlowLogPrevStmt = "Prev_stmt" // SlowLogPlan is used to record the query plan. SlowLogPlan = "Plan" // SlowLogPlanDigest is used to record the query plan digest. SlowLogPlanDigest = "Plan_digest" // SlowLogBinaryPlan is used to record the binary plan. SlowLogBinaryPlan = "Binary_plan" // SlowLogPlanPrefix is the prefix of the plan value. SlowLogPlanPrefix = ast.TiDBDecodePlan + "('" // SlowLogBinaryPlanPrefix is the prefix of the binary plan value. SlowLogBinaryPlanPrefix = ast.TiDBDecodeBinaryPlan + "('" // SlowLogPlanSuffix is the suffix of the plan value. SlowLogPlanSuffix = "')" // SlowLogPrevStmtPrefix is the prefix of Prev_stmt in slow log file. SlowLogPrevStmtPrefix = SlowLogPrevStmt + SlowLogSpaceMarkStr // SlowLogKVTotal is the total time waiting for kv. SlowLogKVTotal = "KV_total" // SlowLogPDTotal is the total time waiting for pd. SlowLogPDTotal = "PD_total" // SlowLogBackoffTotal is the total time doing backoff. SlowLogBackoffTotal = "Backoff_total" // SlowLogWriteSQLRespTotal is the total time used to write response to client. SlowLogWriteSQLRespTotal = "Write_sql_response_total" // SlowLogExecRetryCount is the execution retry count. SlowLogExecRetryCount = "Exec_retry_count" // SlowLogExecRetryTime is the execution retry time. SlowLogExecRetryTime = "Exec_retry_time" // SlowLogBackoffDetail is the detail of backoff. SlowLogBackoffDetail = "Backoff_Detail" // SlowLogResultRows is the row count of the SQL result. SlowLogResultRows = "Result_rows" // SlowLogWarnings is the warnings generated during executing the statement. // Note that some extra warnings would also be printed through slow log. SlowLogWarnings = "Warnings" // SlowLogIsExplicitTxn is used to indicate whether this sql execute in explicit transaction or not. SlowLogIsExplicitTxn = "IsExplicitTxn" // SlowLogIsWriteCacheTable is used to indicate whether writing to the cache table need to wait for the read lock to expire. SlowLogIsWriteCacheTable = "IsWriteCacheTable" // SlowLogIsSyncStatsFailed is used to indicate whether any failure happen during sync stats SlowLogIsSyncStatsFailed = "IsSyncStatsFailed" )
const ( // CharacterSetConnection is the name for character_set_connection system variable. CharacterSetConnection = "character_set_connection" // CollationConnection is the name for collation_connection system variable. CollationConnection = "collation_connection" // CharsetDatabase is the name for character_set_database system variable. CharsetDatabase = "character_set_database" // CollationDatabase is the name for collation_database system variable. CollationDatabase = "collation_database" // CharacterSetFilesystem is the name for character_set_filesystem system variable. CharacterSetFilesystem = "character_set_filesystem" // CharacterSetClient is the name for character_set_client system variable. CharacterSetClient = "character_set_client" // CharacterSetSystem is the name for character_set_system system variable. CharacterSetSystem = "character_set_system" // GeneralLog is the name for 'general_log' system variable. GeneralLog = "general_log" // AvoidTemporalUpgrade is the name for 'avoid_temporal_upgrade' system variable. AvoidTemporalUpgrade = "avoid_temporal_upgrade" // MaxPreparedStmtCount is the name for 'max_prepared_stmt_count' system variable. MaxPreparedStmtCount = "max_prepared_stmt_count" // BigTables is the name for 'big_tables' system variable. BigTables = "big_tables" // CheckProxyUsers is the name for 'check_proxy_users' system variable. CheckProxyUsers = "check_proxy_users" // CoreFile is the name for 'core_file' system variable. CoreFile = "core_file" // DefaultWeekFormat is the name for 'default_week_format' system variable. DefaultWeekFormat = "default_week_format" // GroupConcatMaxLen is the name for 'group_concat_max_len' system variable. GroupConcatMaxLen = "group_concat_max_len" // DelayKeyWrite is the name for 'delay_key_write' system variable. DelayKeyWrite = "delay_key_write" // EndMarkersInJSON is the name for 'end_markers_in_json' system variable. EndMarkersInJSON = "end_markers_in_json" // Hostname is the name for 'hostname' system variable. Hostname = "hostname" // InnodbCommitConcurrency is the name for 'innodb_commit_concurrency' system variable. InnodbCommitConcurrency = "innodb_commit_concurrency" // InnodbFastShutdown is the name for 'innodb_fast_shutdown' system variable. InnodbFastShutdown = "innodb_fast_shutdown" // InnodbLockWaitTimeout is the name for 'innodb_lock_wait_timeout' system variable. InnodbLockWaitTimeout = "innodb_lock_wait_timeout" // SQLLogBin is the name for 'sql_log_bin' system variable. SQLLogBin = "sql_log_bin" // LogBin is the name for 'log_bin' system variable. LogBin = "log_bin" // MaxSortLength is the name for 'max_sort_length' system variable. MaxSortLength = "max_sort_length" // MaxSpRecursionDepth is the name for 'max_sp_recursion_depth' system variable. MaxSpRecursionDepth = "max_sp_recursion_depth" // MaxUserConnections is the name for 'max_user_connections' system variable. MaxUserConnections = "max_user_connections" // OfflineMode is the name for 'offline_mode' system variable. OfflineMode = "offline_mode" // InteractiveTimeout is the name for 'interactive_timeout' system variable. InteractiveTimeout = "interactive_timeout" // FlushTime is the name for 'flush_time' system variable. FlushTime = "flush_time" // PseudoSlaveMode is the name for 'pseudo_slave_mode' system variable. PseudoSlaveMode = "pseudo_slave_mode" // LowPriorityUpdates is the name for 'low_priority_updates' system variable. LowPriorityUpdates = "low_priority_updates" // LowerCaseTableNames is the name for 'lower_case_table_names' system variable. LowerCaseTableNames = "lower_case_table_names" // SessionTrackGtids is the name for 'session_track_gtids' system variable. SessionTrackGtids = "session_track_gtids" // OldPasswords is the name for 'old_passwords' system variable. OldPasswords = "old_passwords" // MaxConnections is the name for 'max_connections' system variable. MaxConnections = "max_connections" // SkipNameResolve is the name for 'skip_name_resolve' system variable. SkipNameResolve = "skip_name_resolve" // ForeignKeyChecks is the name for 'foreign_key_checks' system variable. ForeignKeyChecks = "foreign_key_checks" // SQLSafeUpdates is the name for 'sql_safe_updates' system variable. SQLSafeUpdates = "sql_safe_updates" // WarningCount is the name for 'warning_count' system variable. WarningCount = "warning_count" // ErrorCount is the name for 'error_count' system variable. ErrorCount = "error_count" // DefaultPasswordLifetime is the name for 'default_password_lifetime' system variable. DefaultPasswordLifetime = "default_password_lifetime" // DisconnectOnExpiredPassword is the name for 'disconnect_on_expired_password' system variable. DisconnectOnExpiredPassword = "disconnect_on_expired_password" // SQLSelectLimit is the name for 'sql_select_limit' system variable. SQLSelectLimit = "sql_select_limit" // MaxConnectErrors is the name for 'max_connect_errors' system variable. MaxConnectErrors = "max_connect_errors" // TableDefinitionCache is the name for 'table_definition_cache' system variable. TableDefinitionCache = "table_definition_cache" // Timestamp is the name for 'timestamp' system variable. Timestamp = "timestamp" // ConnectTimeout is the name for 'connect_timeout' system variable. ConnectTimeout = "connect_timeout" // SyncBinlog is the name for 'sync_binlog' system variable. SyncBinlog = "sync_binlog" // BlockEncryptionMode is the name for 'block_encryption_mode' system variable. BlockEncryptionMode = "block_encryption_mode" // WaitTimeout is the name for 'wait_timeout' system variable. WaitTimeout = "wait_timeout" // Version is the name of 'version' system variable. Version = "version" // VersionComment is the name of 'version_comment' system variable. VersionComment = "version_comment" // PluginDir is the name of 'plugin_dir' system variable. PluginDir = "plugin_dir" // PluginLoad is the name of 'plugin_load' system variable. PluginLoad = "plugin_load" // TiDBEnableDDL indicates whether the tidb-server runs DDL statements, TiDBEnableDDL = "tidb_enable_ddl" // Port is the name for 'port' system variable. Port = "port" // DataDir is the name for 'datadir' system variable. DataDir = "datadir" // Profiling is the name for 'Profiling' system variable. Profiling = "profiling" // Socket is the name for 'socket' system variable. Socket = "socket" // BinlogOrderCommits is the name for 'binlog_order_commits' system variable. BinlogOrderCommits = "binlog_order_commits" // MasterVerifyChecksum is the name for 'master_verify_checksum' system variable. MasterVerifyChecksum = "master_verify_checksum" // SuperReadOnly is the name for 'super_read_only' system variable. SuperReadOnly = "super_read_only" // SQLNotes is the name for 'sql_notes' system variable. SQLNotes = "sql_notes" // QueryCacheType is the name for 'query_cache_type' system variable. QueryCacheType = "query_cache_type" // SlaveCompressedProtocol is the name for 'slave_compressed_protocol' system variable. SlaveCompressedProtocol = "slave_compressed_protocol" // BinlogRowQueryLogEvents is the name for 'binlog_rows_query_log_events' system variable. BinlogRowQueryLogEvents = "binlog_rows_query_log_events" // LogSlowSlaveStatements is the name for 'log_slow_slave_statements' system variable. LogSlowSlaveStatements = "log_slow_slave_statements" // LogSlowAdminStatements is the name for 'log_slow_admin_statements' system variable. LogSlowAdminStatements = "log_slow_admin_statements" // LogQueriesNotUsingIndexes is the name for 'log_queries_not_using_indexes' system variable. LogQueriesNotUsingIndexes = "log_queries_not_using_indexes" // QueryCacheWlockInvalidate is the name for 'query_cache_wlock_invalidate' system variable. QueryCacheWlockInvalidate = "query_cache_wlock_invalidate" // SQLAutoIsNull is the name for 'sql_auto_is_null' system variable. SQLAutoIsNull = "sql_auto_is_null" // RelayLogPurge is the name for 'relay_log_purge' system variable. RelayLogPurge = "relay_log_purge" // AutomaticSpPrivileges is the name for 'automatic_sp_privileges' system variable. AutomaticSpPrivileges = "automatic_sp_privileges" // SQLQuoteShowCreate is the name for 'sql_quote_show_create' system variable. SQLQuoteShowCreate = "sql_quote_show_create" // SlowQueryLog is the name for 'slow_query_log' system variable. SlowQueryLog = "slow_query_log" // BinlogDirectNonTransactionalUpdates is the name for 'binlog_direct_non_transactional_updates' system variable. BinlogDirectNonTransactionalUpdates = "binlog_direct_non_transactional_updates" // SQLBigSelects is the name for 'sql_big_selects' system variable. SQLBigSelects = "sql_big_selects" // LogBinTrustFunctionCreators is the name for 'log_bin_trust_function_creators' system variable. LogBinTrustFunctionCreators = "log_bin_trust_function_creators" // OldAlterTable is the name for 'old_alter_table' system variable. OldAlterTable = "old_alter_table" // EnforceGtidConsistency is the name for 'enforce_gtid_consistency' system variable. EnforceGtidConsistency = "enforce_gtid_consistency" // SecureAuth is the name for 'secure_auth' system variable. SecureAuth = "secure_auth" // UniqueChecks is the name for 'unique_checks' system variable. UniqueChecks = "unique_checks" // SQLWarnings is the name for 'sql_warnings' system variable. SQLWarnings = "sql_warnings" // AutoCommit is the name for 'autocommit' system variable. AutoCommit = "autocommit" // KeepFilesOnCreate is the name for 'keep_files_on_create' system variable. KeepFilesOnCreate = "keep_files_on_create" // ShowOldTemporals is the name for 'show_old_temporals' system variable. ShowOldTemporals = "show_old_temporals" // LocalInFile is the name for 'local_infile' system variable. LocalInFile = "local_infile" // PerformanceSchema is the name for 'performance_schema' system variable. PerformanceSchema = "performance_schema" // Flush is the name for 'flush' system variable. Flush = "flush" // SlaveAllowBatching is the name for 'slave_allow_batching' system variable. SlaveAllowBatching = "slave_allow_batching" // MyISAMUseMmap is the name for 'myisam_use_mmap' system variable. MyISAMUseMmap = "myisam_use_mmap" // InnodbFilePerTable is the name for 'innodb_file_per_table' system variable. InnodbFilePerTable = "innodb_file_per_table" // InnodbLogCompressedPages is the name for 'innodb_log_compressed_pages' system variable. InnodbLogCompressedPages = "innodb_log_compressed_pages" // InnodbPrintAllDeadlocks is the name for 'innodb_print_all_deadlocks' system variable. InnodbPrintAllDeadlocks = "innodb_print_all_deadlocks" // InnodbStrictMode is the name for 'innodb_strict_mode' system variable. InnodbStrictMode = "innodb_strict_mode" // InnodbCmpPerIndexEnabled is the name for 'innodb_cmp_per_index_enabled' system variable. InnodbCmpPerIndexEnabled = "innodb_cmp_per_index_enabled" // InnodbBufferPoolDumpAtShutdown is the name for 'innodb_buffer_pool_dump_at_shutdown' system variable. InnodbBufferPoolDumpAtShutdown = "innodb_buffer_pool_dump_at_shutdown" // InnodbAdaptiveHashIndex is the name for 'innodb_adaptive_hash_index' system variable. InnodbAdaptiveHashIndex = "innodb_adaptive_hash_index" // InnodbFtEnableStopword is the name for 'innodb_ft_enable_stopword' system variable. InnodbFtEnableStopword = "innodb_ft_enable_stopword" // #nosec G101 // InnodbSupportXA is the name for 'innodb_support_xa' system variable. InnodbSupportXA = "innodb_support_xa" // InnodbOptimizeFullTextOnly is the name for 'innodb_optimize_fulltext_only' system variable. InnodbOptimizeFullTextOnly = "innodb_optimize_fulltext_only" // InnodbStatusOutputLocks is the name for 'innodb_status_output_locks' system variable. InnodbStatusOutputLocks = "innodb_status_output_locks" // InnodbBufferPoolDumpNow is the name for 'innodb_buffer_pool_dump_now' system variable. InnodbBufferPoolDumpNow = "innodb_buffer_pool_dump_now" // InnodbBufferPoolLoadNow is the name for 'innodb_buffer_pool_load_now' system variable. InnodbBufferPoolLoadNow = "innodb_buffer_pool_load_now" // InnodbStatsOnMetadata is the name for 'innodb_stats_on_metadata' system variable. InnodbStatsOnMetadata = "innodb_stats_on_metadata" // InnodbDisableSortFileCache is the name for 'innodb_disable_sort_file_cache' system variable. InnodbDisableSortFileCache = "innodb_disable_sort_file_cache" // InnodbStatsAutoRecalc is the name for 'innodb_stats_auto_recalc' system variable. InnodbStatsAutoRecalc = "innodb_stats_auto_recalc" // InnodbBufferPoolLoadAbort is the name for 'innodb_buffer_pool_load_abort' system variable. InnodbBufferPoolLoadAbort = "innodb_buffer_pool_load_abort" // InnodbStatsPersistent is the name for 'innodb_stats_persistent' system variable. InnodbStatsPersistent = "innodb_stats_persistent" // InnodbRandomReadAhead is the name for 'innodb_random_read_ahead' system variable. InnodbRandomReadAhead = "innodb_random_read_ahead" // InnodbAdaptiveFlushing is the name for 'innodb_adaptive_flushing' system variable. InnodbAdaptiveFlushing = "innodb_adaptive_flushing" // InnodbTableLocks is the name for 'innodb_table_locks' system variable. InnodbTableLocks = "innodb_table_locks" // InnodbStatusOutput is the name for 'innodb_status_output' system variable. InnodbStatusOutput = "innodb_status_output" // NetBufferLength is the name for 'net_buffer_length' system variable. NetBufferLength = "net_buffer_length" // QueryCacheSize is the name of 'query_cache_size' system variable. QueryCacheSize = "query_cache_size" // TxReadOnly is the name of 'tx_read_only' system variable. TxReadOnly = "tx_read_only" // TransactionReadOnly is the name of 'transaction_read_only' system variable. TransactionReadOnly = "transaction_read_only" // CharacterSetServer is the name of 'character_set_server' system variable. CharacterSetServer = "character_set_server" // AutoIncrementIncrement is the name of 'auto_increment_increment' system variable. AutoIncrementIncrement = "auto_increment_increment" // AutoIncrementOffset is the name of 'auto_increment_offset' system variable. AutoIncrementOffset = "auto_increment_offset" // InitConnect is the name of 'init_connect' system variable. InitConnect = "init_connect" // CollationServer is the name of 'collation_server' variable. CollationServer = "collation_server" // NetWriteTimeout is the name of 'net_write_timeout' variable. NetWriteTimeout = "net_write_timeout" // ThreadPoolSize is the name of 'thread_pool_size' variable. ThreadPoolSize = "thread_pool_size" // WindowingUseHighPrecision is the name of 'windowing_use_high_precision' system variable. WindowingUseHighPrecision = "windowing_use_high_precision" // OptimizerSwitch is the name of 'optimizer_switch' system variable. OptimizerSwitch = "optimizer_switch" // SystemTimeZone is the name of 'system_time_zone' system variable. SystemTimeZone = "system_time_zone" // CTEMaxRecursionDepth is the name of 'cte_max_recursion_depth' system variable. CTEMaxRecursionDepth = "cte_max_recursion_depth" // SQLModeVar is the name of the 'sql_mode' system variable. SQLModeVar = "sql_mode" // CharacterSetResults is the name of the 'character_set_results' system variable. CharacterSetResults = "character_set_results" // MaxAllowedPacket is the name of the 'max_allowed_packet' system variable. MaxAllowedPacket = "max_allowed_packet" // TimeZone is the name of the 'time_zone' system variable. TimeZone = "time_zone" // TxnIsolation is the name of the 'tx_isolation' system variable. TxnIsolation = "tx_isolation" // TransactionIsolation is the name of the 'transaction_isolation' system variable. TransactionIsolation = "transaction_isolation" // TxnIsolationOneShot is the name of the 'tx_isolation_one_shot' system variable. TxnIsolationOneShot = "tx_isolation_one_shot" // MaxExecutionTime is the name of the 'max_execution_time' system variable. MaxExecutionTime = "max_execution_time" // ReadOnly is the name of the 'read_only' system variable. ReadOnly = "read_only" // DefaultAuthPlugin is the name of 'default_authentication_plugin' system variable. DefaultAuthPlugin = "default_authentication_plugin" // LastInsertID is the name of 'last_insert_id' system variable. LastInsertID = "last_insert_id" // Identity is the name of 'identity' system variable. Identity = "identity" // TiDBAllowFunctionForExpressionIndex is the name of `TiDBAllowFunctionForExpressionIndex` system variable. TiDBAllowFunctionForExpressionIndex = "tidb_allow_function_for_expression_index" // RandSeed1 is the name of 'rand_seed1' system variable. RandSeed1 = "rand_seed1" // RandSeed2 is the name of 'rand_seed2' system variable. RandSeed2 = "rand_seed2" // SQLRequirePrimaryKey is the name of `sql_require_primary_key` system variable. SQLRequirePrimaryKey = "sql_require_primary_key" // ValidatePasswordEnable turns on/off the validation of password. ValidatePasswordEnable = "validate_password.enable" // ValidatePasswordPolicy specifies the password policy enforced by validate_password. ValidatePasswordPolicy = "validate_password.policy" // ValidatePasswordCheckUserName controls whether validate_password compares passwords to the user name part of // the effective user account for the current session ValidatePasswordCheckUserName = "validate_password.check_user_name" // ValidatePasswordLength specified the minimum number of characters that validate_password requires passwords to have ValidatePasswordLength = "validate_password.length" // ValidatePasswordMixedCaseCount specified the minimum number of lowercase and uppercase characters that validate_password requires ValidatePasswordMixedCaseCount = "validate_password.mixed_case_count" // ValidatePasswordNumberCount specified the minimum number of numeric (digit) characters that validate_password requires ValidatePasswordNumberCount = "validate_password.number_count" // ValidatePasswordSpecialCharCount specified the minimum number of nonalphanumeric characters that validate_password requires ValidatePasswordSpecialCharCount = "validate_password.special_char_count" // ValidatePasswordDictionary specified the dictionary that validate_password uses for checking passwords. Each word is separated by semicolon (;). ValidatePasswordDictionary = "validate_password.dictionary" )
const ( TiDBDDLSlowOprThreshold = "ddl_slow_threshold" // TiDBSnapshot is used for reading history data, the default value is empty string. // The value can be a datetime string like '2017-11-11 20:20:20' or a tso string. When this variable is set, the session reads history data of that time. TiDBSnapshot = "tidb_snapshot" // TiDBOptAggPushDown is used to enable/disable the optimizer rule of aggregation push down. TiDBOptAggPushDown = "tidb_opt_agg_push_down" // TiDBOptCartesianBCJ is used to disable/enable broadcast cartesian join in MPP mode TiDBOptCartesianBCJ = "tidb_opt_broadcast_cartesian_join" TiDBOptMPPOuterJoinFixedBuildSide = "tidb_opt_mpp_outer_join_fixed_build_side" // TiDBOptDistinctAggPushDown is used to decide whether agg with distinct should be pushed to tikv/tiflash. TiDBOptDistinctAggPushDown = "tidb_opt_distinct_agg_push_down" // TiDBOptSkewDistinctAgg is used to indicate the distinct agg has data skew TiDBOptSkewDistinctAgg = "tidb_opt_skew_distinct_agg" // TiDBOpt3StageDistinctAgg is used to indicate whether to plan and execute the distinct agg in 3 stages TiDBOpt3StageDistinctAgg = "tidb_opt_three_stage_distinct_agg" // TiDBBCJThresholdSize is used to limit the size of small table for mpp broadcast join. // Its unit is bytes, if the size of small table is larger than it, we will not use bcj. TiDBBCJThresholdSize = "tidb_broadcast_join_threshold_size" // TiDBBCJThresholdCount is used to limit the count of small table for mpp broadcast join. // If we can't estimate the size of one side of join child, we will check if its row number exceeds this limitation. TiDBBCJThresholdCount = "tidb_broadcast_join_threshold_count" // TiDBOptWriteRowID is used to enable/disable the operations of insert、replace and update to _tidb_rowid. TiDBOptWriteRowID = "tidb_opt_write_row_id" // TiDBAutoAnalyzeRatio will run if (table modify count)/(table row count) is greater than this value. TiDBAutoAnalyzeRatio = "tidb_auto_analyze_ratio" // TiDBAutoAnalyzeStartTime will run if current time is within start time and end time. TiDBAutoAnalyzeStartTime = "tidb_auto_analyze_start_time" TiDBAutoAnalyzeEndTime = "tidb_auto_analyze_end_time" // TiDBChecksumTableConcurrency is used to speed up the ADMIN CHECKSUM TABLE // statement, when a table has multiple indices, those indices can be // scanned concurrently, with the cost of higher system performance impact. TiDBChecksumTableConcurrency = "tidb_checksum_table_concurrency" // TiDBCurrentTS is used to get the current transaction timestamp. // It is read-only. TiDBCurrentTS = "tidb_current_ts" // TiDBLastTxnInfo is used to get the last transaction info within the current session. TiDBLastTxnInfo = "tidb_last_txn_info" // TiDBLastQueryInfo is used to get the last query info within the current session. TiDBLastQueryInfo = "tidb_last_query_info" // TiDBLastDDLInfo is used to get the last ddl info within the current session. TiDBLastDDLInfo = "tidb_last_ddl_info" // TiDBLastPlanReplayerToken is used to get the last plan replayer token within the current session TiDBLastPlanReplayerToken = "tidb_last_plan_replayer_token" // TiDBConfig is a read-only variable that shows the config of the current server. TiDBConfig = "tidb_config" // TiDBBatchInsert is used to enable/disable auto-split insert data. If set this option on, insert executor will automatically // insert data into multiple batches and use a single txn for each batch. This will be helpful when inserting large data. TiDBBatchInsert = "tidb_batch_insert" // TiDBBatchDelete is used to enable/disable auto-split delete data. If set this option on, delete executor will automatically // split data into multiple batches and use a single txn for each batch. This will be helpful when deleting large data. TiDBBatchDelete = "tidb_batch_delete" // TiDBBatchCommit is used to enable/disable auto-split the transaction. // If set this option on, the transaction will be committed when it reaches stmt-count-limit and starts a new transaction. TiDBBatchCommit = "tidb_batch_commit" // TiDBDMLBatchSize is used to split the insert/delete data into small batches. // It only takes effort when tidb_batch_insert/tidb_batch_delete is on. // Its default value is 20000. When the row size is large, 20k rows could be larger than 100MB. // User could change it to a smaller one to avoid breaking the transaction size limitation. TiDBDMLBatchSize = "tidb_dml_batch_size" // TiDBMemQuotaQuery controls the memory quota of a query. TiDBMemQuotaQuery = "tidb_mem_quota_query" // Bytes. // TiDBMemQuotaApplyCache controls the memory quota of a query. TiDBMemQuotaApplyCache = "tidb_mem_quota_apply_cache" // TiDBGeneralLog is used to log every query in the server in info level. TiDBGeneralLog = "tidb_general_log" // TiDBLogFileMaxDays is used to log every query in the server in info level. TiDBLogFileMaxDays = "tidb_log_file_max_days" // TiDBPProfSQLCPU is used to add label sql label to pprof result. TiDBPProfSQLCPU = "tidb_pprof_sql_cpu" // TiDBRetryLimit is the maximum number of retries when committing a transaction. TiDBRetryLimit = "tidb_retry_limit" // TiDBDisableTxnAutoRetry disables transaction auto retry. TiDBDisableTxnAutoRetry = "tidb_disable_txn_auto_retry" // TiDBEnableChunkRPC enables TiDB to use Chunk format for coprocessor requests. TiDBEnableChunkRPC = "tidb_enable_chunk_rpc" // TiDBOptimizerSelectivityLevel is used to control the selectivity estimation level. TiDBOptimizerSelectivityLevel = "tidb_optimizer_selectivity_level" // TiDBOptimizerEnableNewOnlyFullGroupByCheck is used to open the newly only_full_group_by check by maintaining functional dependency. TiDBOptimizerEnableNewOnlyFullGroupByCheck = "tidb_enable_new_only_full_group_by_check" TiDBOptimizerEnableOuterJoinReorder = "tidb_enable_outer_join_reorder" // TiDBOptimizerEnableNAAJ is used to open the newly null-aware anti join TiDBOptimizerEnableNAAJ = "tidb_enable_null_aware_anti_join" // TiDBTxnMode is used to control the transaction behavior. TiDBTxnMode = "tidb_txn_mode" // TiDBRowFormatVersion is used to control tidb row format version current. TiDBRowFormatVersion = "tidb_row_format_version" // TiDBEnableTablePartition is used to control table partition feature. // The valid value include auto/on/off: // on or auto: enable table partition if the partition type is implemented. // off: always disable table partition. TiDBEnableTablePartition = "tidb_enable_table_partition" // TiDBEnableListTablePartition is used to control list table partition feature. TiDBEnableListTablePartition = "tidb_enable_list_partition" // TiDBSkipIsolationLevelCheck is used to control whether to return error when set unsupported transaction // isolation level. TiDBSkipIsolationLevelCheck = "tidb_skip_isolation_level_check" // TiDBLowResolutionTSO is used for reading data with low resolution TSO which is updated once every two seconds TiDBLowResolutionTSO = "tidb_low_resolution_tso" // TiDBReplicaRead is used for reading data from replicas, followers for example. TiDBReplicaRead = "tidb_replica_read" // TiDBAdaptiveClosestReadThreshold is for reading data from closest replicas(with same 'zone' label). // TiKV client should send read request to the closest replica(leader/follower) if the estimated response // size exceeds this threshold; otherwise, this request should be sent to leader. // This variable only take effect when `tidb_replica_read` is 'closest-adaptive'. TiDBAdaptiveClosestReadThreshold = "tidb_adaptive_closest_read_threshold" // TiDBAllowRemoveAutoInc indicates whether a user can drop the auto_increment column attribute or not. TiDBAllowRemoveAutoInc = "tidb_allow_remove_auto_inc" // TiDBMultiStatementMode enables multi statement at the risk of SQL injection // provides backwards compatibility TiDBMultiStatementMode = "tidb_multi_statement_mode" // TiDBEvolvePlanTaskMaxTime controls the max time of a single evolution task. TiDBEvolvePlanTaskMaxTime = "tidb_evolve_plan_task_max_time" // TiDBEvolvePlanTaskStartTime is the start time of evolution task. TiDBEvolvePlanTaskStartTime = "tidb_evolve_plan_task_start_time" // TiDBEvolvePlanTaskEndTime is the end time of evolution task. TiDBEvolvePlanTaskEndTime = "tidb_evolve_plan_task_end_time" // TiDBSlowLogThreshold is used to set the slow log threshold in the server. TiDBSlowLogThreshold = "tidb_slow_log_threshold" // TiDBRecordPlanInSlowLog is used to log the plan of the slow query. TiDBRecordPlanInSlowLog = "tidb_record_plan_in_slow_log" // TiDBEnableSlowLog enables TiDB to log slow queries. TiDBEnableSlowLog = "tidb_enable_slow_log" // TiDBCheckMb4ValueInUTF8 is used to control whether to enable the check wrong utf8 value. TiDBCheckMb4ValueInUTF8 = "tidb_check_mb4_value_in_utf8" // TiDBFoundInPlanCache indicates whether the last statement was found in plan cache TiDBFoundInPlanCache = "last_plan_from_cache" // TiDBFoundInBinding indicates whether the last statement was matched with the hints in the binding. TiDBFoundInBinding = "last_plan_from_binding" // TiDBAllowAutoRandExplicitInsert indicates whether explicit insertion on auto_random column is allowed. TiDBAllowAutoRandExplicitInsert = "allow_auto_random_explicit_insert" // TiDBTxnScope indicates whether using global transactions or local transactions. TiDBTxnScope = "txn_scope" // TiDBTxnReadTS indicates the next transaction should be staleness transaction and provide the startTS TiDBTxnReadTS = "tx_read_ts" // TiDBReadStaleness indicates the staleness duration for following statement TiDBReadStaleness = "tidb_read_staleness" // TiDBEnablePaging indicates whether paging is enabled in coprocessor requests. TiDBEnablePaging = "tidb_enable_paging" // TiDBReadConsistency indicates whether the autocommit read statement goes through TiKV RC. TiDBReadConsistency = "tidb_read_consistency" // TiDBSysdateIsNow is the name of the `tidb_sysdate_is_now` system variable TiDBSysdateIsNow = "tidb_sysdate_is_now" // RequireSecureTransport indicates the secure mode for data transport RequireSecureTransport = "require_secure_transport" // TiFlashFastScan indicates whether use fast scan in tiflash. TiFlashFastScan = "tiflash_fastscan" // TiDBEnableUnsafeSubstitute indicates whether to enable generate column takes unsafe substitute. TiDBEnableUnsafeSubstitute = "tidb_enable_unsafe_substitute" // TiDBEnableTiFlashReadForWriteStmt indicates whether to enable TiFlash to read for write statements. TiDBEnableTiFlashReadForWriteStmt = "tidb_enable_tiflash_read_for_write_stmt" // TiDBUseAlloc indicates whether the last statement used chunk alloc TiDBUseAlloc = "last_sql_use_alloc" )
TiDB system variable names that only in session scope.
const ( // TiDBBuildStatsConcurrency is used to speed up the ANALYZE statement, when a table has multiple indices, // those indices can be scanned concurrently, with the cost of higher system performance impact. TiDBBuildStatsConcurrency = "tidb_build_stats_concurrency" // TiDBDistSQLScanConcurrency is used to set the concurrency of a distsql scan task. // A distsql scan task can be a table scan or a index scan, which may be distributed to many TiKV nodes. // Higher concurrency may reduce latency, but with the cost of higher memory usage and system performance impact. // If the query has a LIMIT clause, high concurrency makes the system do much more work than needed. TiDBDistSQLScanConcurrency = "tidb_distsql_scan_concurrency" // TiDBOptInSubqToJoinAndAgg is used to enable/disable the optimizer rule of rewriting IN subquery. TiDBOptInSubqToJoinAndAgg = "tidb_opt_insubq_to_join_and_agg" // TiDBOptPreferRangeScan is used to enable/disable the optimizer to always prefer range scan over table scan, ignoring their costs. TiDBOptPreferRangeScan = "tidb_opt_prefer_range_scan" // TiDBOptEnableCorrelationAdjustment is used to indicates if enable correlation adjustment. TiDBOptEnableCorrelationAdjustment = "tidb_opt_enable_correlation_adjustment" // TiDBOptLimitPushDownThreshold determines if push Limit or TopN down to TiKV forcibly. TiDBOptLimitPushDownThreshold = "tidb_opt_limit_push_down_threshold" // TiDBOptCorrelationThreshold is a guard to enable row count estimation using column order correlation. TiDBOptCorrelationThreshold = "tidb_opt_correlation_threshold" // TiDBOptCorrelationExpFactor is an exponential factor to control heuristic approach when tidb_opt_correlation_threshold is not satisfied. TiDBOptCorrelationExpFactor = "tidb_opt_correlation_exp_factor" // TiDBOptCPUFactor is the CPU cost of processing one expression for one row. TiDBOptCPUFactor = "tidb_opt_cpu_factor" // TiDBOptCopCPUFactor is the CPU cost of processing one expression for one row in coprocessor. TiDBOptCopCPUFactor = "tidb_opt_copcpu_factor" // TiDBOptTiFlashConcurrencyFactor is concurrency number of tiflash computation. TiDBOptTiFlashConcurrencyFactor = "tidb_opt_tiflash_concurrency_factor" // TiDBOptNetworkFactor is the network cost of transferring 1 byte data. TiDBOptNetworkFactor = "tidb_opt_network_factor" // TiDBOptScanFactor is the IO cost of scanning 1 byte data on TiKV. TiDBOptScanFactor = "tidb_opt_scan_factor" // TiDBOptDescScanFactor is the IO cost of scanning 1 byte data on TiKV in desc order. TiDBOptDescScanFactor = "tidb_opt_desc_factor" // TiDBOptSeekFactor is the IO cost of seeking the start value in a range on TiKV or TiFlash. TiDBOptSeekFactor = "tidb_opt_seek_factor" // TiDBOptMemoryFactor is the memory cost of storing one tuple. TiDBOptMemoryFactor = "tidb_opt_memory_factor" // TiDBOptDiskFactor is the IO cost of reading/writing one byte to temporary disk. TiDBOptDiskFactor = "tidb_opt_disk_factor" // TiDBOptConcurrencyFactor is the CPU cost of additional one goroutine. TiDBOptConcurrencyFactor = "tidb_opt_concurrency_factor" // TiDBOptForceInlineCTE is used to enable/disable inline CTE TiDBOptForceInlineCTE = "tidb_opt_force_inline_cte" // TiDBIndexJoinBatchSize is used to set the batch size of an index lookup join. // The index lookup join fetches batches of data from outer executor and constructs ranges for inner executor. // This value controls how much of data in a batch to do the index join. // Large value may reduce the latency but consumes more system resource. TiDBIndexJoinBatchSize = "tidb_index_join_batch_size" // TiDBIndexLookupSize is used for index lookup executor. // The index lookup executor first scan a batch of handles from a index, then use those handles to lookup the table // rows, this value controls how much of handles in a batch to do a lookup task. // Small value sends more RPCs to TiKV, consume more system resource. // Large value may do more work than needed if the query has a limit. TiDBIndexLookupSize = "tidb_index_lookup_size" // TiDBIndexLookupConcurrency is used for index lookup executor. // A lookup task may have 'tidb_index_lookup_size' of handles at maximum, the handles may be distributed // in many TiKV nodes, we execute multiple concurrent index lookup tasks concurrently to reduce the time // waiting for a task to finish. // Set this value higher may reduce the latency but consumes more system resource. // tidb_index_lookup_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBIndexLookupConcurrency = "tidb_index_lookup_concurrency" // TiDBIndexLookupJoinConcurrency is used for index lookup join executor. // IndexLookUpJoin starts "tidb_index_lookup_join_concurrency" inner workers // to fetch inner rows and join the matched (outer, inner) row pairs. // tidb_index_lookup_join_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBIndexLookupJoinConcurrency = "tidb_index_lookup_join_concurrency" // TiDBIndexSerialScanConcurrency is used for controlling the concurrency of index scan operation // when we need to keep the data output order the same as the order of index data. TiDBIndexSerialScanConcurrency = "tidb_index_serial_scan_concurrency" // TiDBMaxChunkSize is used to control the max chunk size during query execution. TiDBMaxChunkSize = "tidb_max_chunk_size" // TiDBAllowBatchCop means if we should send batch coprocessor to TiFlash. It can be set to 0, 1 and 2. // 0 means never use batch cop, 1 means use batch cop in case of aggregation and join, 2, means to force sending batch cop for any query. // The default value is 0 TiDBAllowBatchCop = "tidb_allow_batch_cop" // TiDBAllowMPPExecution means if we should use mpp way to execute query or not. // Default value is `true`, means to be determined by the optimizer. // Value set to `false` means never use mpp. TiDBAllowMPPExecution = "tidb_allow_mpp" // TiDBHashExchangeWithNewCollation means if hash exchange is supported when new collation is on. // Default value is `true`, means support hash exchange when new collation is on. // Value set to `false` means not support hash exchange when new collation is on. TiDBHashExchangeWithNewCollation = "tidb_hash_exchange_with_new_collation" // TiDBEnforceMPPExecution means if we should enforce mpp way to execute query or not. // Default value is `false`, means to be determined by variable `tidb_allow_mpp`. // Value set to `true` means enforce use mpp. // Note if you want to set `tidb_enforce_mpp` to `true`, you must set `tidb_allow_mpp` to `true` first. TiDBEnforceMPPExecution = "tidb_enforce_mpp" // TiDBMaxTiFlashThreads is the maximum number of threads to execute the request which is pushed down to tiflash. // Default value is -1, means it will not be pushed down to tiflash. // If the value is bigger than -1, it will be pushed down to tiflash and used to create db context in tiflash. TiDBMaxTiFlashThreads = "tidb_max_tiflash_threads" // TiDBMPPStoreFailTTL is the unavailable time when a store is detected failed. During that time, tidb will not send any task to // TiFlash even though the failed TiFlash node has been recovered. TiDBMPPStoreFailTTL = "tidb_mpp_store_fail_ttl" // TiDBInitChunkSize is used to control the init chunk size during query execution. TiDBInitChunkSize = "tidb_init_chunk_size" // TiDBMinPagingSize is used to control the min paging size in the coprocessor paging protocol. TiDBMinPagingSize = "tidb_min_paging_size" // TiDBMaxPagingSize is used to control the max paging size in the coprocessor paging protocol. TiDBMaxPagingSize = "tidb_max_paging_size" // TiDBEnableCascadesPlanner is used to control whether to enable the cascades planner. TiDBEnableCascadesPlanner = "tidb_enable_cascades_planner" // TiDBSkipUTF8Check skips the UTF8 validate process, validate UTF8 has performance cost, if we can make sure // the input string values are valid, we can skip the check. TiDBSkipUTF8Check = "tidb_skip_utf8_check" // TiDBSkipASCIICheck skips the ASCII validate process // old tidb may already have fields with invalid ASCII bytes // disable ASCII validate can guarantee a safe replication TiDBSkipASCIICheck = "tidb_skip_ascii_check" // TiDBHashJoinConcurrency is used for hash join executor. // The hash join outer executor starts multiple concurrent join workers to probe the hash table. // tidb_hash_join_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBHashJoinConcurrency = "tidb_hash_join_concurrency" // TiDBProjectionConcurrency is used for projection operator. // This variable controls the worker number of projection operator. // tidb_projection_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBProjectionConcurrency = "tidb_projection_concurrency" // TiDBHashAggPartialConcurrency is used for hash agg executor. // The hash agg executor starts multiple concurrent partial workers to do partial aggregate works. // tidb_hashagg_partial_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBHashAggPartialConcurrency = "tidb_hashagg_partial_concurrency" // TiDBHashAggFinalConcurrency is used for hash agg executor. // The hash agg executor starts multiple concurrent final workers to do final aggregate works. // tidb_hashagg_final_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBHashAggFinalConcurrency = "tidb_hashagg_final_concurrency" // TiDBWindowConcurrency is used for window parallel executor. // tidb_window_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBWindowConcurrency = "tidb_window_concurrency" // TiDBMergeJoinConcurrency is used for merge join parallel executor TiDBMergeJoinConcurrency = "tidb_merge_join_concurrency" // TiDBStreamAggConcurrency is used for stream aggregation parallel executor. // tidb_stream_agg_concurrency is deprecated, use tidb_executor_concurrency instead. TiDBStreamAggConcurrency = "tidb_streamagg_concurrency" // TiDBIndexMergeIntersectionConcurrency is used for parallel worker of index merge intersection. TiDBIndexMergeIntersectionConcurrency = "tidb_index_merge_intersection_concurrency" // TiDBEnableParallelApply is used for parallel apply. TiDBEnableParallelApply = "tidb_enable_parallel_apply" // TiDBBackoffLockFast is used for tikv backoff base time in milliseconds. TiDBBackoffLockFast = "tidb_backoff_lock_fast" // TiDBBackOffWeight is used to control the max back off time in TiDB. // The default maximum back off time is a small value. // BackOffWeight could multiply it to let the user adjust the maximum time for retrying. // Only positive integers can be accepted, which means that the maximum back off time can only grow. TiDBBackOffWeight = "tidb_backoff_weight" // TiDBDDLReorgWorkerCount defines the count of ddl reorg workers. TiDBDDLReorgWorkerCount = "tidb_ddl_reorg_worker_cnt" // TiDBDDLFlashbackConcurrency defines the count of ddl flashback workers. TiDBDDLFlashbackConcurrency = "tidb_ddl_flashback_concurrency" // TiDBDDLReorgBatchSize defines the transaction batch size of ddl reorg workers. TiDBDDLReorgBatchSize = "tidb_ddl_reorg_batch_size" // TiDBDDLErrorCountLimit defines the count of ddl error limit. TiDBDDLErrorCountLimit = "tidb_ddl_error_count_limit" // TiDBDDLReorgPriority defines the operations' priority of adding indices. // It can be: PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_HIGH TiDBDDLReorgPriority = "tidb_ddl_reorg_priority" // TiDBEnableAutoIncrementInGenerated disables the mysql compatibility check on using auto-incremented columns in // expression indexes and generated columns described here https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html for details. TiDBEnableAutoIncrementInGenerated = "tidb_enable_auto_increment_in_generated" // TiDBPlacementMode is used to control the mode for placement TiDBPlacementMode = "tidb_placement_mode" // TiDBMaxDeltaSchemaCount defines the max length of deltaSchemaInfos. // deltaSchemaInfos is a queue that maintains the history of schema changes. TiDBMaxDeltaSchemaCount = "tidb_max_delta_schema_count" // TiDBScatterRegion will scatter the regions for DDLs when it is ON. TiDBScatterRegion = "tidb_scatter_region" // TiDBWaitSplitRegionFinish defines the split region behaviour is sync or async. TiDBWaitSplitRegionFinish = "tidb_wait_split_region_finish" // TiDBWaitSplitRegionTimeout uses to set the split and scatter region back off time. TiDBWaitSplitRegionTimeout = "tidb_wait_split_region_timeout" // TiDBForcePriority defines the operations' priority of all statements. // It can be "NO_PRIORITY", "LOW_PRIORITY", "HIGH_PRIORITY", "DELAYED" TiDBForcePriority = "tidb_force_priority" // TiDBConstraintCheckInPlace indicates to check the constraint when the SQL executing. // It could hurt the performance of bulking insert when it is ON. TiDBConstraintCheckInPlace = "tidb_constraint_check_in_place" // TiDBEnableWindowFunction is used to control whether to enable the window function. TiDBEnableWindowFunction = "tidb_enable_window_function" // TiDBEnablePipelinedWindowFunction is used to control whether to use pipelined window function, it only works when tidb_enable_window_function = true. TiDBEnablePipelinedWindowFunction = "tidb_enable_pipelined_window_function" // TiDBEnableStrictDoubleTypeCheck is used to control table field double type syntax check. TiDBEnableStrictDoubleTypeCheck = "tidb_enable_strict_double_type_check" // TiDBOptProjectionPushDown is used to control whether to pushdown projection to coprocessor. TiDBOptProjectionPushDown = "tidb_opt_projection_push_down" // TiDBEnableVectorizedExpression is used to control whether to enable the vectorized expression evaluation. TiDBEnableVectorizedExpression = "tidb_enable_vectorized_expression" // TiDBOptJoinReorderThreshold defines the threshold less than which // we'll choose a rather time-consuming algorithm to calculate the join order. TiDBOptJoinReorderThreshold = "tidb_opt_join_reorder_threshold" // TiDBSlowQueryFile indicates which slow query log file for SLOW_QUERY table to parse. TiDBSlowQueryFile = "tidb_slow_query_file" // TiDBEnableFastAnalyze indicates to use fast analyze. TiDBEnableFastAnalyze = "tidb_enable_fast_analyze" // TiDBExpensiveQueryTimeThreshold indicates the time threshold of expensive query. TiDBExpensiveQueryTimeThreshold = "tidb_expensive_query_time_threshold" // TiDBEnableIndexMerge indicates to generate IndexMergePath. TiDBEnableIndexMerge = "tidb_enable_index_merge" // TiDBEnableNoopFuncs set true will enable using fake funcs(like get_lock release_lock) TiDBEnableNoopFuncs = "tidb_enable_noop_functions" // TiDBEnableStmtSummary indicates whether the statement summary is enabled. TiDBEnableStmtSummary = "tidb_enable_stmt_summary" // TiDBStmtSummaryInternalQuery indicates whether the statement summary contain internal query. TiDBStmtSummaryInternalQuery = "tidb_stmt_summary_internal_query" // TiDBStmtSummaryRefreshInterval indicates the refresh interval in seconds for each statement summary. TiDBStmtSummaryRefreshInterval = "tidb_stmt_summary_refresh_interval" // TiDBStmtSummaryHistorySize indicates the history size of each statement summary. TiDBStmtSummaryHistorySize = "tidb_stmt_summary_history_size" // TiDBStmtSummaryMaxStmtCount indicates the max number of statements kept in memory. TiDBStmtSummaryMaxStmtCount = "tidb_stmt_summary_max_stmt_count" // TiDBStmtSummaryMaxSQLLength indicates the max length of displayed normalized sql and sample sql. TiDBStmtSummaryMaxSQLLength = "tidb_stmt_summary_max_sql_length" // TiDBCapturePlanBaseline indicates whether the capture of plan baselines is enabled. TiDBCapturePlanBaseline = "tidb_capture_plan_baselines" // TiDBUsePlanBaselines indicates whether the use of plan baselines is enabled. TiDBUsePlanBaselines = "tidb_use_plan_baselines" // TiDBEvolvePlanBaselines indicates whether the evolution of plan baselines is enabled. TiDBEvolvePlanBaselines = "tidb_evolve_plan_baselines" // TiDBEnableExtendedStats indicates whether the extended statistics feature is enabled. TiDBEnableExtendedStats = "tidb_enable_extended_stats" // TiDBIsolationReadEngines indicates the tidb only read from the stores whose engine type is involved in IsolationReadEngines. // Now, only support TiKV and TiFlash. TiDBIsolationReadEngines = "tidb_isolation_read_engines" // TiDBStoreLimit indicates the limit of sending request to a store, 0 means without limit. TiDBStoreLimit = "tidb_store_limit" // TiDBMetricSchemaStep indicates the step when query metric schema. TiDBMetricSchemaStep = "tidb_metric_query_step" // TiDBCDCWriteSource indicates the following data is written by TiCDC if it is not 0. TiDBCDCWriteSource = "tidb_cdc_write_source" // TiDBMetricSchemaRangeDuration indicates the range duration when query metric schema. TiDBMetricSchemaRangeDuration = "tidb_metric_query_range_duration" // TiDBEnableCollectExecutionInfo indicates that whether execution info is collected. TiDBEnableCollectExecutionInfo = "tidb_enable_collect_execution_info" // TiDBExecutorConcurrency is used for controlling the concurrency of all types of executors. TiDBExecutorConcurrency = "tidb_executor_concurrency" // TiDBEnableClusteredIndex indicates if clustered index feature is enabled. TiDBEnableClusteredIndex = "tidb_enable_clustered_index" // TiDBPartitionPruneMode indicates the partition prune mode used. TiDBPartitionPruneMode = "tidb_partition_prune_mode" // TiDBRedactLog indicates that whether redact log. TiDBRedactLog = "tidb_redact_log" // TiDBRestrictedReadOnly is meant for the cloud admin to toggle the cluster read only TiDBRestrictedReadOnly = "tidb_restricted_read_only" // TiDBSuperReadOnly is tidb's variant of mysql's super_read_only, which has some differences from mysql's super_read_only. TiDBSuperReadOnly = "tidb_super_read_only" // TiDBShardAllocateStep indicates the max size of continuous rowid shard in one transaction. TiDBShardAllocateStep = "tidb_shard_allocate_step" // TiDBEnableTelemetry indicates that whether usage data report to PingCAP is enabled. TiDBEnableTelemetry = "tidb_enable_telemetry" // TiDBMemoryUsageAlarmRatio indicates the alarm threshold when memory usage of the tidb-server exceeds. TiDBMemoryUsageAlarmRatio = "tidb_memory_usage_alarm_ratio" // TiDBMemoryUsageAlarmKeepRecordNum indicates the number of saved alarm files. TiDBMemoryUsageAlarmKeepRecordNum = "tidb_memory_usage_alarm_keep_record_num" // TiDBEnableRateLimitAction indicates whether enabled ratelimit action TiDBEnableRateLimitAction = "tidb_enable_rate_limit_action" // TiDBEnableAsyncCommit indicates whether to enable the async commit feature. TiDBEnableAsyncCommit = "tidb_enable_async_commit" // TiDBEnable1PC indicates whether to enable the one-phase commit feature. TiDBEnable1PC = "tidb_enable_1pc" // TiDBGuaranteeLinearizability indicates whether to guarantee linearizability. TiDBGuaranteeLinearizability = "tidb_guarantee_linearizability" // TiDBAnalyzeVersion indicates how tidb collects the analyzed statistics and how use to it. TiDBAnalyzeVersion = "tidb_analyze_version" // TiDBAutoAnalyzePartitionBatchSize indicates the batch size for partition tables for auto analyze in dynamic mode TiDBAutoAnalyzePartitionBatchSize = "tidb_auto_analyze_partition_batch_size" // TiDBEnableIndexMergeJoin indicates whether to enable index merge join. TiDBEnableIndexMergeJoin = "tidb_enable_index_merge_join" // TiDBTrackAggregateMemoryUsage indicates whether track the memory usage of aggregate function. TiDBTrackAggregateMemoryUsage = "tidb_track_aggregate_memory_usage" // TiDBEnableExchangePartition indicates whether to enable exchange partition. TiDBEnableExchangePartition = "tidb_enable_exchange_partition" // TiDBAllowFallbackToTiKV indicates the engine types whose unavailability triggers fallback to TiKV. // Now we only support TiFlash. TiDBAllowFallbackToTiKV = "tidb_allow_fallback_to_tikv" // TiDBEnableTopSQL indicates whether the top SQL is enabled. TiDBEnableTopSQL = "tidb_enable_top_sql" // TiDBSourceID indicates the source ID of the TiDB server. TiDBSourceID = "tidb_source_id" // TiDBTopSQLMaxTimeSeriesCount indicates the max number of statements been collected in each time series. TiDBTopSQLMaxTimeSeriesCount = "tidb_top_sql_max_time_series_count" // TiDBTopSQLMaxMetaCount indicates the max capacity of the collect meta per second. TiDBTopSQLMaxMetaCount = "tidb_top_sql_max_meta_count" // TiDBEnableLocalTxn indicates whether to enable Local Txn. TiDBEnableLocalTxn = "tidb_enable_local_txn" // TiDBEnableMDL indicates whether to enable MDL. TiDBEnableMDL = "tidb_enable_metadata_lock" // TiDBTSOClientBatchMaxWaitTime indicates the max value of the TSO Batch Wait interval time of PD client. TiDBTSOClientBatchMaxWaitTime = "tidb_tso_client_batch_max_wait_time" // TiDBTxnCommitBatchSize is used to control the batch size of transaction commit related requests sent by TiDB to TiKV. // If a single transaction has a large amount of writes, you can increase the batch size to improve the batch effect, // setting too large will exceed TiKV's raft-entry-max-size limit and cause commit failure. TiDBTxnCommitBatchSize = "tidb_txn_commit_batch_size" // TiDBEnableTSOFollowerProxy indicates whether to enable the TSO Follower Proxy feature of PD client. TiDBEnableTSOFollowerProxy = "tidb_enable_tso_follower_proxy" // TiDBEnableOrderedResultMode indicates if stabilize query results. TiDBEnableOrderedResultMode = "tidb_enable_ordered_result_mode" // TiDBRemoveOrderbyInSubquery indicates whether to remove ORDER BY in subquery. TiDBRemoveOrderbyInSubquery = "tidb_remove_orderby_in_subquery" // TiDBEnablePseudoForOutdatedStats indicates whether use pseudo for outdated stats TiDBEnablePseudoForOutdatedStats = "tidb_enable_pseudo_for_outdated_stats" // TiDBRegardNULLAsPoint indicates whether regard NULL as point when optimizing TiDBRegardNULLAsPoint = "tidb_regard_null_as_point" // TiDBTmpTableMaxSize indicates the max memory size of temporary tables. TiDBTmpTableMaxSize = "tidb_tmp_table_max_size" // TiDBEnableLegacyInstanceScope indicates if instance scope can be set with SET SESSION. TiDBEnableLegacyInstanceScope = "tidb_enable_legacy_instance_scope" // TiDBTableCacheLease indicates the read lock lease of a cached table. TiDBTableCacheLease = "tidb_table_cache_lease" // TiDBStatsLoadSyncWait indicates the time sql execution will sync-wait for stats load. TiDBStatsLoadSyncWait = "tidb_stats_load_sync_wait" // TiDBEnableMutationChecker indicates whether to check data consistency for mutations TiDBEnableMutationChecker = "tidb_enable_mutation_checker" // TiDBTxnAssertionLevel indicates how strict the assertion will be, which helps to detect and preventing data & // index inconsistency problems. TiDBTxnAssertionLevel = "tidb_txn_assertion_level" // TiDBIgnorePreparedCacheCloseStmt indicates whether to ignore close-stmt commands for prepared statements. TiDBIgnorePreparedCacheCloseStmt = "tidb_ignore_prepared_cache_close_stmt" // TiDBEnableNewCostInterface is a internal switch to indicates whether to use the new cost calculation interface. TiDBEnableNewCostInterface = "tidb_enable_new_cost_interface" // TiDBCostModelVersion is a internal switch to indicates the cost model version. TiDBCostModelVersion = "tidb_cost_model_version" // TiDBIndexJoinDoubleReadPenaltyCostRate indicates whether to add some penalty cost to IndexJoin and how much of it. // IndexJoin can cause plenty of extra double read tasks, which consume lots of resources and take a long time. // Since the number of double read tasks is hard to estimated accurately, we leave this variable to let us can adjust this // part of cost manually. TiDBIndexJoinDoubleReadPenaltyCostRate = "tidb_index_join_double_read_penalty_cost_rate" // TiDBBatchPendingTiFlashCount indicates the maximum count of non-available TiFlash tables. TiDBBatchPendingTiFlashCount = "tidb_batch_pending_tiflash_count" // TiDBQueryLogMaxLen is used to set the max length of the query in the log. TiDBQueryLogMaxLen = "tidb_query_log_max_len" // TiDBEnableNoopVariables is used to indicate if noops appear in SHOW [GLOBAL] VARIABLES TiDBEnableNoopVariables = "tidb_enable_noop_variables" // TiDBNonTransactionalIgnoreError is used to ignore error in non-transactional DMLs. // When set to false, a non-transactional DML returns when it meets the first error. // When set to true, a non-transactional DML finishes all batches even if errors are met in some batches. TiDBNonTransactionalIgnoreError = "tidb_nontransactional_ignore_error" // Fine grained shuffle is disabled when TiFlashFineGrainedShuffleStreamCount is zero. TiFlashFineGrainedShuffleStreamCount = "tiflash_fine_grained_shuffle_stream_count" TiFlashFineGrainedShuffleBatchSize = "tiflash_fine_grained_shuffle_batch_size" // TiDBSimplifiedMetrics controls whether to unregister some unused metrics. TiDBSimplifiedMetrics = "tidb_simplified_metrics" // TiDBMemoryDebugModeMinHeapInUse is used to set tidb memory debug mode trigger threshold. // When set to 0, the function is disabled. // When set to a negative integer, use memory debug mode to detect the issue of frequent allocation and release of memory. // We do not actively trigger gc, and check whether the `tracker memory * (1+bias ratio) > heap in use` each 5s. // When set to a positive integer, use memory debug mode to detect the issue of memory tracking inaccurate. // We trigger runtime.GC() each 5s, and check whether the `tracker memory * (1+bias ratio) > heap in use`. TiDBMemoryDebugModeMinHeapInUse = "tidb_memory_debug_mode_min_heap_inuse" // TiDBMemoryDebugModeAlarmRatio is used set tidb memory debug mode bias ratio. Treat memory bias less than this ratio as noise. TiDBMemoryDebugModeAlarmRatio = "tidb_memory_debug_mode_alarm_ratio" // TiDBEnableAnalyzeSnapshot indicates whether to read data on snapshot when collecting statistics. // When set to false, ANALYZE reads the latest data. // When set to true, ANALYZE reads data on the snapshot at the beginning of ANALYZE. TiDBEnableAnalyzeSnapshot = "tidb_enable_analyze_snapshot" // TiDBDefaultStrMatchSelectivity controls some special cardinality estimation strategy for string match functions (like and regexp). // When set to 0, Selectivity() will try to evaluate those functions with TopN and NULL in the stats to estimate, // and the default selectivity and the selectivity for the histogram part will be 0.1. // When set to (0, 1], Selectivity() will use the value of this variable as the default selectivity of those // functions instead of the selectionFactor (0.8). TiDBDefaultStrMatchSelectivity = "tidb_default_string_match_selectivity" // TiDBEnablePrepPlanCache indicates whether to enable prepared plan cache TiDBEnablePrepPlanCache = "tidb_enable_prepared_plan_cache" // TiDBPrepPlanCacheSize indicates the number of cached statements. TiDBPrepPlanCacheSize = "tidb_prepared_plan_cache_size" // TiDBEnablePrepPlanCacheMemoryMonitor indicates whether to enable prepared plan cache monitor TiDBEnablePrepPlanCacheMemoryMonitor = "tidb_enable_prepared_plan_cache_memory_monitor" // TiDBEnableNonPreparedPlanCache indicates whether to enable non-prepared plan cache. TiDBEnableNonPreparedPlanCache = "tidb_enable_non_prepared_plan_cache" // TiDBNonPreparedPlanCacheSize controls the size of non-prepared plan cache. TiDBNonPreparedPlanCacheSize = "tidb_non_prepared_plan_cache_size" // TiDBConstraintCheckInPlacePessimistic controls whether to skip certain kinds of pessimistic locks. TiDBConstraintCheckInPlacePessimistic = "tidb_constraint_check_in_place_pessimistic" // TiDBEnableForeignKey indicates whether to enable foreign key feature. // TODO(crazycs520): remove this after foreign key GA. TiDBEnableForeignKey = "tidb_enable_foreign_key" // TiDBOptRangeMaxSize is the max memory limit for ranges. When the optimizer estimates that the memory usage of complete // ranges would exceed the limit, it chooses less accurate ranges such as full range. 0 indicates that there is no memory // limit for ranges. TiDBOptRangeMaxSize = "tidb_opt_range_max_size" // TiDBAnalyzePartitionConcurrency indicates concurrency for save/read partitions stats in Analyze TiDBAnalyzePartitionConcurrency = "tidb_analyze_partition_concurrency" // TiDBMergePartitionStatsConcurrency indicates the concurrency when merge partition stats into global stats TiDBMergePartitionStatsConcurrency = "tidb_merge_partition_stats_concurrency" // TiDBOptPrefixIndexSingleScan indicates whether to do some optimizations to avoid double scan for prefix index. // When set to true, `col is (not) null`(`col` is index prefix column) is regarded as index filter rather than table filter. TiDBOptPrefixIndexSingleScan = "tidb_opt_prefix_index_single_scan" // TiDBEnableExternalTSRead indicates whether to enable read through an external ts TiDBEnableExternalTSRead = "tidb_enable_external_ts_read" // TiDBEnablePlanReplayerCapture indicates whether to enable plan replayer capture TiDBEnablePlanReplayerCapture = "tidb_enable_plan_replayer_capture" // TiDBEnablePlanReplayerContinuesCapture indicates whether to enable continues capture TiDBEnablePlanReplayerContinuesCapture = "tidb_enable_plan_replayer_continues_capture" // TiDBEnableReusechunk indicates whether to enable chunk alloc TiDBEnableReusechunk = "tidb_enable_reuse_chunk" // TiDBStoreBatchSize indicates the batch size of coprocessor in the same store. TiDBStoreBatchSize = "tidb_store_batch_size" // TiDBPessimisticTransactionAggressiveLocking controls whether aggressive locking for pessimistic transaction // is enabled. TiDBPessimisticTransactionAggressiveLocking = "tidb_pessimistic_txn_aggressive_locking" // TiDBEnablePlanCacheForParamLimit controls whether prepare statement with parameterized limit can be cached TiDBEnablePlanCacheForParamLimit = "tidb_enable_plan_cache_for_param_limit" )
TiDB system variable names that both in session and global scope.
const ( // TiDBGCEnable turns garbage collection on or OFF TiDBGCEnable = "tidb_gc_enable" // TiDBGCRunInterval sets the interval that GC runs TiDBGCRunInterval = "tidb_gc_run_interval" // TiDBGCLifetime sets the retention window of older versions TiDBGCLifetime = "tidb_gc_life_time" // TiDBGCConcurrency sets the concurrency of garbage collection. -1 = AUTO value TiDBGCConcurrency = "tidb_gc_concurrency" // TiDBGCScanLockMode enables the green GC feature (default) TiDBGCScanLockMode = "tidb_gc_scan_lock_mode" // TiDBGCMaxWaitTime sets max time for gc advances the safepoint delayed by active transactions TiDBGCMaxWaitTime = "tidb_gc_max_wait_time" // TiDBEnableEnhancedSecurity restricts SUPER users from certain operations. TiDBEnableEnhancedSecurity = "tidb_enable_enhanced_security" // TiDBEnableHistoricalStats enables the historical statistics feature (default off) TiDBEnableHistoricalStats = "tidb_enable_historical_stats" // TiDBPersistAnalyzeOptions persists analyze options for later analyze and auto-analyze TiDBPersistAnalyzeOptions = "tidb_persist_analyze_options" // TiDBEnableColumnTracking enables collecting predicate columns. TiDBEnableColumnTracking = "tidb_enable_column_tracking" // TiDBDisableColumnTrackingTime records the last time TiDBEnableColumnTracking is set off. // It is used to invalidate the collected predicate columns after turning off TiDBEnableColumnTracking, which avoids physical deletion. // It doesn't have cache in memory, and we directly get/set the variable value from/to mysql.tidb. TiDBDisableColumnTrackingTime = "tidb_disable_column_tracking_time" // TiDBStatsLoadPseudoTimeout indicates whether to fallback to pseudo stats after load timeout. TiDBStatsLoadPseudoTimeout = "tidb_stats_load_pseudo_timeout" // TiDBMemQuotaBindingCache indicates the memory quota for the bind cache. TiDBMemQuotaBindingCache = "tidb_mem_quota_binding_cache" // TiDBRCReadCheckTS indicates the tso optimization for read-consistency read is enabled. TiDBRCReadCheckTS = "tidb_rc_read_check_ts" // TiDBRCWriteCheckTs indicates whether some special write statements don't get latest tso from PD at RC TiDBRCWriteCheckTs = "tidb_rc_write_check_ts" // TiDBCommitterConcurrency controls the number of running concurrent requests in the commit phase. TiDBCommitterConcurrency = "tidb_committer_concurrency" // TiDBEnableBatchDML enables batch dml. TiDBEnableBatchDML = "tidb_enable_batch_dml" // TiDBStatsCacheMemQuota records stats cache quota TiDBStatsCacheMemQuota = "tidb_stats_cache_mem_quota" // TiDBMemQuotaAnalyze indicates the memory quota for all analyze jobs. TiDBMemQuotaAnalyze = "tidb_mem_quota_analyze" // TiDBEnableAutoAnalyze determines whether TiDB executes automatic analysis. TiDBEnableAutoAnalyze = "tidb_enable_auto_analyze" // TiDBMemOOMAction indicates what operation TiDB perform when a single SQL statement exceeds // the memory quota specified by tidb_mem_quota_query and cannot be spilled to disk. TiDBMemOOMAction = "tidb_mem_oom_action" // TiDBPrepPlanCacheMemoryGuardRatio is used to prevent [performance.max-memory] from being exceeded TiDBPrepPlanCacheMemoryGuardRatio = "tidb_prepared_plan_cache_memory_guard_ratio" // TiDBMaxAutoAnalyzeTime is the max time that auto analyze can run. If auto analyze runs longer than the value, it // will be killed. 0 indicates that there is no time limit. TiDBMaxAutoAnalyzeTime = "tidb_max_auto_analyze_time" // TiDBDDLEnableDistributeReorg indicates whether to enable the new Reorg framework. TiDBDDLEnableDistributeReorg = "tidb_ddl_distribute_reorg" // TiDBGenerateBinaryPlan indicates whether binary plan should be generated in slow log and statements summary. TiDBGenerateBinaryPlan = "tidb_generate_binary_plan" // TiDBEnableGCAwareMemoryTrack indicates whether to turn-on GC-aware memory track. TiDBEnableGCAwareMemoryTrack = "tidb_enable_gc_aware_memory_track" // TiDBEnableTmpStorageOnOOM controls whether to enable the temporary storage for some operators // when a single SQL statement exceeds the memory quota specified by the memory quota. TiDBEnableTmpStorageOnOOM = "tidb_enable_tmp_storage_on_oom" // TiDBDDLEnableFastReorg indicates whether to use lighting backfill process for adding index. TiDBDDLEnableFastReorg = "tidb_ddl_enable_fast_reorg" // TiDBDDLDiskQuota used to set disk quota for lightning add index. TiDBDDLDiskQuota = "tidb_ddl_disk_quota" // TiDBAutoBuildStatsConcurrency is used to set the build concurrency of auto-analyze. TiDBAutoBuildStatsConcurrency = "tidb_auto_build_stats_concurrency" // TiDBSysProcScanConcurrency is used to set the scan concurrency of for backend system processes, like auto-analyze. TiDBSysProcScanConcurrency = "tidb_sysproc_scan_concurrency" // TiDBServerMemoryLimit indicates the memory limit of the tidb-server instance. TiDBServerMemoryLimit = "tidb_server_memory_limit" // TiDBServerMemoryLimitSessMinSize indicates the minimal memory used of a session, that becomes a candidate for session kill. TiDBServerMemoryLimitSessMinSize = "tidb_server_memory_limit_sess_min_size" // TiDBServerMemoryLimitGCTrigger indicates the gc percentage of the TiDBServerMemoryLimit. TiDBServerMemoryLimitGCTrigger = "tidb_server_memory_limit_gc_trigger" // TiDBEnableGOGCTuner is to enable GOGC tuner. it can tuner GOGC TiDBEnableGOGCTuner = "tidb_enable_gogc_tuner" // TiDBGOGCTunerThreshold is to control the threshold of GOGC tuner. TiDBGOGCTunerThreshold = "tidb_gogc_tuner_threshold" // TiDBExternalTS is the ts to read through when the `TiDBEnableExternalTsRead` is on TiDBExternalTS = "tidb_external_ts" // TiDBTTLJobEnable is used to enable/disable scheduling ttl job TiDBTTLJobEnable = "tidb_ttl_job_enable" // TiDBTTLScanBatchSize is used to control the batch size in the SELECT statement for TTL jobs TiDBTTLScanBatchSize = "tidb_ttl_scan_batch_size" // TiDBTTLDeleteBatchSize is used to control the batch size in the DELETE statement for TTL jobs TiDBTTLDeleteBatchSize = "tidb_ttl_delete_batch_size" // TiDBTTLDeleteRateLimit is used to control the delete rate limit for TTL jobs in each node TiDBTTLDeleteRateLimit = "tidb_ttl_delete_rate_limit" // TiDBTTLJobScheduleWindowStartTime is used to restrict the start time of the time window of scheduling the ttl jobs. TiDBTTLJobScheduleWindowStartTime = "tidb_ttl_job_schedule_window_start_time" // TiDBTTLJobScheduleWindowEndTime is used to restrict the end time of the time window of scheduling the ttl jobs. TiDBTTLJobScheduleWindowEndTime = "tidb_ttl_job_schedule_window_end_time" // TiDBTTLScanWorkerCount indicates the count of the scan workers in each TiDB node TiDBTTLScanWorkerCount = "tidb_ttl_scan_worker_count" // TiDBTTLDeleteWorkerCount indicates the count of the delete workers in each TiDB node TiDBTTLDeleteWorkerCount = "tidb_ttl_delete_worker_count" // PasswordReuseHistory limit a few passwords to reuse. PasswordReuseHistory = "password_history" // PasswordReuseTime limit how long passwords can be reused. PasswordReuseTime = "password_reuse_interval" // TiDBHistoricalStatsDuration indicates the duration to remain tidb historical stats TiDBHistoricalStatsDuration = "tidb_historical_stats_duration" // TiDBEnableHistoricalStatsForCapture indicates whether use historical stats in plan replayer capture TiDBEnableHistoricalStatsForCapture = "tidb_enable_historical_stats_for_capture" // TiDBEnableResourceControl indicates whether resource control feature is enabled TiDBEnableResourceControl = "tidb_enable_resource_control" )
const ( DefHostname = "localhost" DefIndexLookupConcurrency = ConcurrencyUnset DefIndexLookupJoinConcurrency = ConcurrencyUnset DefIndexSerialScanConcurrency = 1 DefIndexJoinBatchSize = 25000 DefIndexLookupSize = 20000 DefDistSQLScanConcurrency = 15 DefBuildStatsConcurrency = 4 DefAutoAnalyzeRatio = 0.5 DefAutoAnalyzeStartTime = "00:00 +0000" DefAutoAnalyzeEndTime = "23:59 +0000" DefAutoIncrementIncrement = 1 DefAutoIncrementOffset = 1 DefChecksumTableConcurrency = 4 DefSkipUTF8Check = false DefSkipASCIICheck = false DefOptAggPushDown = false DefOptCartesianBCJ = 1 DefOptMPPOuterJoinFixedBuildSide = false DefOptWriteRowID = false DefOptEnableCorrelationAdjustment = true DefOptLimitPushDownThreshold = 100 DefOptCorrelationThreshold = 0.9 DefOptCorrelationExpFactor = 1 DefOptCPUFactor = 3.0 DefOptCopCPUFactor = 3.0 DefOptTiFlashConcurrencyFactor = 24.0 DefOptNetworkFactor = 1.0 DefOptScanFactor = 1.5 DefOptDescScanFactor = 3.0 DefOptSeekFactor = 20.0 DefOptMemoryFactor = 0.001 DefOptDiskFactor = 1.5 DefOptConcurrencyFactor = 3.0 DefOptForceInlineCTE = false DefOptInSubqToJoinAndAgg = true DefOptPreferRangeScan = false DefBatchInsert = false DefBatchDelete = false DefBatchCommit = false DefCurretTS = 0 DefInitChunkSize = 32 DefMinPagingSize = int(paging.MinPagingSize) DefMaxPagingSize = int(paging.MaxPagingSize) DefMaxChunkSize = 1024 DefDMLBatchSize = 0 DefMaxPreparedStmtCount = -1 DefWaitTimeout = 28800 DefTiDBMemQuotaApplyCache = 32 << 20 // 32MB. DefTiDBMemQuotaBindingCache = 64 << 20 // 64MB. DefTiDBGeneralLog = false DefTiDBPProfSQLCPU = 0 DefTiDBRetryLimit = 10 DefTiDBDisableTxnAutoRetry = true DefTiDBConstraintCheckInPlace = false DefTiDBHashJoinConcurrency = ConcurrencyUnset DefTiDBProjectionConcurrency = ConcurrencyUnset DefBroadcastJoinThresholdSize = 100 * 1024 * 1024 DefBroadcastJoinThresholdCount = 10 * 1024 DefTiDBOptimizerSelectivityLevel = 0 DefTiDBOptimizerEnableNewOFGB = false DefTiDBEnableOuterJoinReorder = true DefTiDBEnableNAAJ = false DefTiDBAllowBatchCop = 1 DefTiDBAllowMPPExecution = true DefTiDBHashExchangeWithNewCollation = true DefTiDBEnforceMPPExecution = false DefTiFlashMaxThreads = -1 DefTiDBMPPStoreFailTTL = "60s" DefTiDBTxnMode = "" DefTiDBRowFormatV1 = 1 DefTiDBRowFormatV2 = 2 DefTiDBDDLReorgWorkerCount = 4 DefTiDBDDLReorgBatchSize = 256 DefTiDBDDLFlashbackConcurrency = 64 DefTiDBDDLErrorCountLimit = 512 DefTiDBMaxDeltaSchemaCount = 1024 DefTiDBPlacementMode = PlacementModeStrict DefTiDBEnableAutoIncrementInGenerated = false DefTiDBHashAggPartialConcurrency = ConcurrencyUnset DefTiDBHashAggFinalConcurrency = ConcurrencyUnset DefTiDBWindowConcurrency = ConcurrencyUnset DefTiDBMergeJoinConcurrency = 1 // disable optimization by default DefTiDBStreamAggConcurrency = 1 DefTiDBForcePriority = mysql.NoPriority DefEnableWindowFunction = true DefEnablePipelinedWindowFunction = true DefEnableStrictDoubleTypeCheck = true DefEnableVectorizedExpression = true DefTiDBOptJoinReorderThreshold = 0 DefTiDBDDLSlowOprThreshold = 300 DefTiDBUseFastAnalyze = false DefTiDBSkipIsolationLevelCheck = false DefTiDBExpensiveQueryTimeThreshold = 60 // 60s DefTiDBScatterRegion = false DefTiDBWaitSplitRegionFinish = true DefWaitSplitRegionTimeout = 300 // 300s DefTiDBEnableNoopFuncs = Off DefTiDBEnableNoopVariables = true DefTiDBAllowRemoveAutoInc = false DefTiDBUsePlanBaselines = true DefTiDBEvolvePlanBaselines = false DefTiDBEvolvePlanTaskMaxTime = 600 // 600s DefTiDBEvolvePlanTaskStartTime = "00:00 +0000" DefTiDBEvolvePlanTaskEndTime = "23:59 +0000" DefInnodbLockWaitTimeout = 50 // 50s DefTiDBStoreLimit = 0 DefTiDBMetricSchemaStep = 60 // 60s DefTiDBMetricSchemaRangeDuration = 60 // 60s DefTiDBFoundInPlanCache = false DefTiDBFoundInBinding = false DefTiDBEnableCollectExecutionInfo = true DefTiDBAllowAutoRandExplicitInsert = false DefTiDBEnableClusteredIndex = ClusteredIndexDefModeOn DefTiDBRedactLog = false DefTiDBRestrictedReadOnly = false DefTiDBSuperReadOnly = false DefTiDBShardAllocateStep = math.MaxInt64 DefTiDBEnableTelemetry = true DefTiDBEnableParallelApply = false DefTiDBPartitionPruneMode = "dynamic" DefTiDBEnableRateLimitAction = false DefTiDBEnableAsyncCommit = false DefTiDBEnable1PC = false DefTiDBGuaranteeLinearizability = true DefTiDBAnalyzeVersion = 2 DefTiDBAutoAnalyzePartitionBatchSize = 1 DefTiDBEnableIndexMergeJoin = false DefTiDBTrackAggregateMemoryUsage = true DefTiDBEnableExchangePartition = true DefCTEMaxRecursionDepth = 1000 DefTiDBTmpTableMaxSize = 64 << 20 // 64MB. DefTiDBEnableLocalTxn = false DefTiDBTSOClientBatchMaxWaitTime = 0.0 // 0ms DefTiDBEnableTSOFollowerProxy = false DefTiDBEnableOrderedResultMode = false DefTiDBEnablePseudoForOutdatedStats = false DefTiDBRegardNULLAsPoint = true DefEnablePlacementCheck = true DefTimestamp = "0" DefTimestampFloat = 0.0 DefTiDBEnableStmtSummary = true DefTiDBStmtSummaryInternalQuery = false DefTiDBStmtSummaryRefreshInterval = 1800 DefTiDBStmtSummaryHistorySize = 24 DefTiDBStmtSummaryMaxStmtCount = 3000 DefTiDBStmtSummaryMaxSQLLength = 4096 DefTiDBCapturePlanBaseline = Off DefTiDBEnableIndexMerge = true DefEnableLegacyInstanceScope = true DefTiDBTableCacheLease = 3 // 3s DefTiDBPersistAnalyzeOptions = true DefTiDBEnableColumnTracking = false DefTiDBStatsLoadSyncWait = 100 DefTiDBStatsLoadPseudoTimeout = true DefSysdateIsNow = false DefTiDBEnableMutationChecker = false DefTiDBTxnAssertionLevel = AssertionOffStr DefTiDBIgnorePreparedCacheCloseStmt = false DefTiDBBatchPendingTiFlashCount = 4000 DefRCReadCheckTS = false DefTiDBRemoveOrderbyInSubquery = false DefTiDBSkewDistinctAgg = false DefTiDB3StageDistinctAgg = true DefTiDBReadStaleness = 0 DefTiDBGCMaxWaitTime = 24 * 60 * 60 DefMaxAllowedPacket uint64 = 67108864 DefTiDBEnableBatchDML = false DefTiDBMemQuotaQuery = 1073741824 // 1GB DefTiDBStatsCacheMemQuota = 0 MaxTiDBStatsCacheMemQuota = 1024 * 1024 * 1024 * 1024 // 1TB DefTiDBQueryLogMaxLen = 4096 DefRequireSecureTransport = false DefTiDBCommitterConcurrency = 128 DefTiDBBatchDMLIgnoreError = false DefTiDBMemQuotaAnalyze = -1 DefTiDBEnableAutoAnalyze = true DefTiDBMemOOMAction = "CANCEL" DefTiDBMaxAutoAnalyzeTime = 12 * 60 * 60 DefTiDBEnablePrepPlanCache = true DefTiDBPrepPlanCacheSize = 100 DefTiDBEnablePrepPlanCacheMemoryMonitor = true DefTiDBPrepPlanCacheMemoryGuardRatio = 0.1 DefTiDBDDLEnableDistributeReorg = distributereorg.TiDBEnableDistributeReorg DefTiDBSimplifiedMetrics = false DefTiDBEnablePaging = true DefTiFlashFineGrainedShuffleStreamCount = 0 DefStreamCountWhenMaxThreadsNotSet = 8 DefTiFlashFineGrainedShuffleBatchSize = 8192 DefAdaptiveClosestReadThreshold = 4096 DefTiDBEnableAnalyzeSnapshot = false DefTiDBGenerateBinaryPlan = true DefEnableTiDBGCAwareMemoryTrack = false DefTiDBDefaultStrMatchSelectivity = 0.8 DefTiDBEnableTmpStorageOnOOM = true DefTiDBEnableMDL = true DefTiFlashFastScan = false DefMemoryUsageAlarmRatio = 0.7 DefMemoryUsageAlarmKeepRecordNum = 5 DefTiDBEnableFastReorg = true DefTiDBDDLDiskQuota = 100 * 1024 * 1024 * 1024 // 100GB DefExecutorConcurrency = 5 DefTiDBEnableNonPreparedPlanCache = false DefTiDBNonPreparedPlanCacheSize = 100 DefTiDBEnableTiFlashReadForWriteStmt = false // MaxDDLReorgBatchSize is exported for testing. MaxDDLReorgBatchSize int32 = 10240 MinDDLReorgBatchSize int32 = 32 MinExpensiveQueryTimeThreshold uint64 = 10 // 10s DefTiDBAutoBuildStatsConcurrency = 1 DefTiDBSysProcScanConcurrency = 1 DefTiDBRcWriteCheckTs = false DefTiDBForeignKeyChecks = true DefTiDBAnalyzePartitionConcurrency = 1 DefTiDBOptRangeMaxSize = 64 * int64(size.MB) // 64 MB DefTiDBCostModelVer = 2 DefTiDBServerMemoryLimitSessMinSize = 128 << 20 DefTiDBMergePartitionStatsConcurrency = 1 DefTiDBServerMemoryLimitGCTrigger = 0.7 DefTiDBEnableGOGCTuner = true // DefTiDBGOGCTunerThreshold is to limit TiDBGOGCTunerThreshold. DefTiDBGOGCTunerThreshold float64 = 0.6 DefTiDBOptPrefixIndexSingleScan = true DefTiDBExternalTS = 0 DefTiDBEnableExternalTSRead = false DefTiDBEnableReusechunk = true DefTiDBUseAlloc = false DefTiDBEnablePlanReplayerCapture = false DefTiDBIndexMergeIntersectionConcurrency = ConcurrencyUnset DefTiDBTTLJobEnable = true DefTiDBTTLScanBatchSize = 500 DefTiDBTTLScanBatchMaxSize = 10240 DefTiDBTTLScanBatchMinSize = 1 DefTiDBTTLDeleteBatchSize = 100 DefTiDBTTLDeleteBatchMaxSize = 10240 DefTiDBTTLDeleteBatchMinSize = 1 DefTiDBTTLDeleteRateLimit = 0 DefPasswordReuseHistory = 0 DefPasswordReuseTime = 0 DefTiDBStoreBatchSize = 0 DefTiDBHistoricalStatsDuration = 7 * 24 * time.Hour DefTiDBEnableHistoricalStatsForCapture = false DefTiDBTTLJobScheduleWindowStartTime = "00:00 +0000" DefTiDBTTLJobScheduleWindowEndTime = "23:59 +0000" DefTiDBTTLScanWorkerCount = 4 DefTiDBTTLDeleteWorkerCount = 4 DefTiDBEnableResourceControl = false DefTiDBPessimisticTransactionAggressiveLocking = false DefTiDBEnablePlanCacheForParamLimit = true )
Default TiDB system variable values.
const ( // ScopeNone means the system variable can not be changed dynamically. ScopeNone ScopeFlag = 0 // ScopeGlobal means the system variable can be changed globally. ScopeGlobal ScopeFlag = 1 << 0 // ScopeSession means the system variable can only be changed in current session. ScopeSession ScopeFlag = 1 << 1 // ScopeInstance means it is similar to global but doesn't propagate to other TiDB servers. ScopeInstance ScopeFlag = 1 << 2 // TypeStr is the default TypeStr TypeFlag = iota // TypeBool for boolean TypeBool // TypeInt for integer TypeInt // TypeEnum for Enum TypeEnum // TypeFloat for Double TypeFloat // TypeUnsigned for Unsigned integer TypeUnsigned // TypeTime for time of day (a TiDB extension) TypeTime // TypeDuration for a golang duration (a TiDB extension) TypeDuration // On is the canonical string for ON On = "ON" // Off is the canonical string for OFF Off = "OFF" // Warn means return warnings Warn = "WARN" // IntOnly means enable for int type IntOnly = "INT_ONLY" // AssertionStrictStr is a choice of variable TiDBTxnAssertionLevel that means full assertions should be performed, // even if the performance might be slowed down. AssertionStrictStr = "STRICT" // AssertionFastStr is a choice of variable TiDBTxnAssertionLevel that means assertions that doesn't affect // performance should be performed. AssertionFastStr = "FAST" // AssertionOffStr is a choice of variable TiDBTxnAssertionLevel that means no assertion should be performed. AssertionOffStr = "OFF" // OOMActionCancel constants represents the valid action configurations for OOMAction "CANCEL". OOMActionCancel = "CANCEL" // OOMActionLog constants represents the valid action configurations for OOMAction "LOG". OOMActionLog = "LOG" )
const ( GlobalConfigEnableTopSQL = "enable_resource_metering" GlobalConfigSourceID = "source_id" )
Global config name list.
const ( // OffInt is used by TiDBOptOnOffWarn OffInt = 0 // OnInt is used TiDBOptOnOffWarn OnInt = 1 // WarnInt is used by TiDBOptOnOffWarn WarnInt = 2 )
const ConcurrencyUnset = -1
ConcurrencyUnset means the value the of the concurrency related variable is unset.
const (
// FullDayTimeFormat is the full format of analyze start time and end time.
FullDayTimeFormat = "15:04 -0700"
)
const ( // MaxConfigurableConcurrency is the maximum number of "threads" (goroutines) that can be specified // for any type of configuration item that has concurrent workers. MaxConfigurableConcurrency = 256 )
Variables ¶
var ( ErrSnapshotTooOld = dbterror.ClassVariable.NewStd(mysql.ErrSnapshotTooOld) ErrUnsupportedValueForVar = dbterror.ClassVariable.NewStd(mysql.ErrUnsupportedValueForVar) ErrUnknownSystemVar = dbterror.ClassVariable.NewStd(mysql.ErrUnknownSystemVariable) ErrIncorrectScope = dbterror.ClassVariable.NewStd(mysql.ErrIncorrectGlobalLocalVar) ErrUnknownTimeZone = dbterror.ClassVariable.NewStd(mysql.ErrUnknownTimeZone) ErrReadOnly = dbterror.ClassVariable.NewStd(mysql.ErrVariableIsReadonly) ErrWrongValueForVar = dbterror.ClassVariable.NewStd(mysql.ErrWrongValueForVar) ErrWrongTypeForVar = dbterror.ClassVariable.NewStd(mysql.ErrWrongTypeForVar) ErrTruncatedWrongValue = dbterror.ClassVariable.NewStd(mysql.ErrTruncatedWrongValue) ErrMaxPreparedStmtCountReached = dbterror.ClassVariable.NewStd(mysql.ErrMaxPreparedStmtCountReached) ErrUnsupportedIsolationLevel = dbterror.ClassVariable.NewStd(mysql.ErrUnsupportedIsolationLevel) ErrStmtNotFound = dbterror.ClassOptimizer.NewStd(mysql.ErrPreparedStmtNotFound) ErrNotValidPassword = dbterror.ClassExecutor.NewStd(mysql.ErrNotValidPassword) // ErrFunctionsNoopImpl is an error to say the behavior is protected by the tidb_enable_noop_functions sysvar. // This is copied from expression.ErrFunctionsNoopImpl to prevent circular dependencies. // It needs to be public for tests. ErrFunctionsNoopImpl = dbterror.ClassVariable.NewStdErr(mysql.ErrNotSupportedYet, pmysql.Message("function %s has only noop implementation in tidb now, use tidb_enable_noop_functions to enable these functions", nil)) ErrVariableNoLongerSupported = dbterror.ClassVariable.NewStd(mysql.ErrVariableNoLongerSupported) )
Error instances.
var ( ProcessGeneralLog = atomic.NewBool(false) RunAutoAnalyze = atomic.NewBool(DefTiDBEnableAutoAnalyze) GlobalLogMaxDays = atomic.NewInt32(int32(config.GetGlobalConfig().Log.File.MaxDays)) QueryLogMaxLen = atomic.NewInt32(DefTiDBQueryLogMaxLen) EnablePProfSQLCPU = atomic.NewBool(false) EnableBatchDML = atomic.NewBool(false) EnableTmpStorageOnOOM = atomic.NewBool(DefTiDBEnableTmpStorageOnOOM) // DDLSlowOprThreshold is the threshold for ddl slow operations, uint is millisecond. DDLSlowOprThreshold = config.GetGlobalConfig().Instance.DDLSlowOprThreshold ForcePriority = int32(DefTiDBForcePriority) MaxOfMaxAllowedPacket uint64 = 1073741824 ExpensiveQueryTimeThreshold uint64 = DefTiDBExpensiveQueryTimeThreshold MemoryUsageAlarmRatio = atomic.NewFloat64(DefMemoryUsageAlarmRatio) MemoryUsageAlarmKeepRecordNum = atomic.NewInt64(DefMemoryUsageAlarmKeepRecordNum) EnableLocalTxn = atomic.NewBool(DefTiDBEnableLocalTxn) MaxTSOBatchWaitInterval = atomic.NewFloat64(DefTiDBTSOClientBatchMaxWaitTime) EnableTSOFollowerProxy = atomic.NewBool(DefTiDBEnableTSOFollowerProxy) RestrictedReadOnly = atomic.NewBool(DefTiDBRestrictedReadOnly) VarTiDBSuperReadOnly = atomic.NewBool(DefTiDBSuperReadOnly) PersistAnalyzeOptions = atomic.NewBool(DefTiDBPersistAnalyzeOptions) TableCacheLease = atomic.NewInt64(DefTiDBTableCacheLease) EnableColumnTracking = atomic.NewBool(DefTiDBEnableColumnTracking) StatsLoadSyncWait = atomic.NewInt64(DefTiDBStatsLoadSyncWait) StatsLoadPseudoTimeout = atomic.NewBool(DefTiDBStatsLoadPseudoTimeout) MemQuotaBindingCache = atomic.NewInt64(DefTiDBMemQuotaBindingCache) GCMaxWaitTime = atomic.NewInt64(DefTiDBGCMaxWaitTime) StatsCacheMemQuota = atomic.NewInt64(DefTiDBStatsCacheMemQuota) OOMAction = atomic.NewString(DefTiDBMemOOMAction) MaxAutoAnalyzeTime = atomic.NewInt64(DefTiDBMaxAutoAnalyzeTime) // variables for plan cache PreparedPlanCacheMemoryGuardRatio = atomic.NewFloat64(DefTiDBPrepPlanCacheMemoryGuardRatio) DDLEnableDistributeReorg = atomic.NewBool(DefTiDBDDLEnableDistributeReorg) DDLForce2Queue = atomic.NewBool(false) EnableNoopVariables = atomic.NewBool(DefTiDBEnableNoopVariables) EnableMDL = atomic.NewBool(false) AutoAnalyzePartitionBatchSize = atomic.NewInt64(DefTiDBAutoAnalyzePartitionBatchSize) // EnableFastReorg indicates whether to use lightning to enhance DDL reorg performance. EnableFastReorg = atomic.NewBool(DefTiDBEnableFastReorg) // DDLDiskQuota is the temporary variable for set disk quota for lightning DDLDiskQuota = atomic.NewUint64(DefTiDBDDLDiskQuota) // EnableForeignKey indicates whether to enable foreign key feature. EnableForeignKey = atomic.NewBool(true) EnableRCReadCheckTS = atomic.NewBool(false) // DefTiDBServerMemoryLimit indicates the default value of TiDBServerMemoryLimit(TotalMem * 80%). // It should be a const and shouldn't be modified after tidb is started. DefTiDBServerMemoryLimit = serverMemoryLimitDefaultValue() GOGCTunerThreshold = atomic.NewFloat64(DefTiDBGOGCTunerThreshold) PasswordValidationLength = atomic.NewInt32(8) PasswordValidationMixedCaseCount = atomic.NewInt32(1) PasswordValidtaionNumberCount = atomic.NewInt32(1) PasswordValidationSpecialCharCount = atomic.NewInt32(1) EnableTTLJob = atomic.NewBool(DefTiDBTTLJobEnable) TTLScanBatchSize = atomic.NewInt64(DefTiDBTTLScanBatchSize) TTLDeleteBatchSize = atomic.NewInt64(DefTiDBTTLDeleteBatchSize) TTLDeleteRateLimit = atomic.NewInt64(DefTiDBTTLDeleteRateLimit) TTLJobScheduleWindowStartTime = atomic.NewTime(mustParseTime(FullDayTimeFormat, DefTiDBTTLJobScheduleWindowStartTime)) TTLJobScheduleWindowEndTime = atomic.NewTime(mustParseTime(FullDayTimeFormat, DefTiDBTTLJobScheduleWindowEndTime)) TTLScanWorkerCount = atomic.NewInt32(DefTiDBTTLScanWorkerCount) TTLDeleteWorkerCount = atomic.NewInt32(DefTiDBTTLDeleteWorkerCount) PasswordHistory = atomic.NewInt64(DefPasswordReuseHistory) PasswordReuseInterval = atomic.NewInt64(DefPasswordReuseTime) IsSandBoxModeEnabled = atomic.NewBool(false) MaxPreparedStmtCountValue = atomic.NewInt64(DefMaxPreparedStmtCount) HistoricalStatsDuration = atomic.NewDuration(DefTiDBHistoricalStatsDuration) EnableHistoricalStatsForCapture = atomic.NewBool(DefTiDBEnableHistoricalStatsForCapture) EnableResourceControl = atomic.NewBool(DefTiDBEnableResourceControl) )
Process global variables.
var ( // SetMemQuotaAnalyze is the func registered by global/subglobal tracker to set memory quota. SetMemQuotaAnalyze func(quota int64) = nil // GetMemQuotaAnalyze is the func registered by global/subglobal tracker to get memory quota. GetMemQuotaAnalyze func() int64 = nil // SetStatsCacheCapacity is the func registered by domain to set statsCache memory quota. SetStatsCacheCapacity atomic.Value // SetPDClientDynamicOption is the func registered by domain SetPDClientDynamicOption atomic.Pointer[func(string, string)] // SwitchMDL is the func registered by DDL to switch MDL. SwitchMDL func(bool2 bool) error = nil // EnableDDL is the func registered by ddl to enable running ddl in this instance. EnableDDL func() error = nil // DisableDDL is the func registered by ddl to disable running ddl in this instance. DisableDDL func() error = nil // SetExternalTimestamp is the func registered by staleread to set externaltimestamp in pd SetExternalTimestamp func(ctx context.Context, ts uint64) error // GetExternalTimestamp is the func registered by staleread to get externaltimestamp from pd GetExternalTimestamp func(ctx context.Context) (uint64, error) // SetGlobalResourceControl is the func registered by domain to set cluster resource control. SetGlobalResourceControl atomic.Pointer[func(bool)] )
var ( // EnableGlobalResourceControlFunc is the function registered by tikv_driver to set cluster resource control. EnableGlobalResourceControlFunc func() = func() {} // DisableGlobalResourceControlFunc is the function registered by tikv_driver to unset cluster resource control. DisableGlobalResourceControlFunc func() = func() {} )
Hooks functions for Cluster Resource Control.
var DefaultStatusVarScopeFlag = ScopeGlobal | ScopeSession
DefaultStatusVarScopeFlag is the default scope of status variables.
var FeedbackProbability *atomic2.Float64
FeedbackProbability points to the FeedbackProbability in statistics package. It's initialized in init() in feedback.go to solve import cycle.
var GAFunction4ExpressionIndex = map[string]struct{}{ ast.Lower: {}, ast.Upper: {}, ast.MD5: {}, ast.Reverse: {}, ast.VitessHash: {}, ast.TiDBShard: {}, ast.JSONType: {}, ast.JSONExtract: {}, ast.JSONUnquote: {}, ast.JSONArray: {}, ast.JSONObject: {}, ast.JSONSet: {}, ast.JSONInsert: {}, ast.JSONReplace: {}, ast.JSONRemove: {}, ast.JSONContains: {}, ast.JSONContainsPath: {}, ast.JSONValid: {}, ast.JSONArrayAppend: {}, ast.JSONArrayInsert: {}, ast.JSONMergePatch: {}, ast.JSONMergePreserve: {}, ast.JSONPretty: {}, ast.JSONQuote: {}, ast.JSONSearch: {}, ast.JSONStorageSize: {}, ast.JSONDepth: {}, ast.JSONKeys: {}, ast.JSONLength: {}, }
GAFunction4ExpressionIndex stores functions GA for expression index.
var GenerateBinaryPlan atomic2.Bool
GenerateBinaryPlan decides whether we should record binary plan in slow log and stmt summary. It's controlled by the global variable `tidb_generate_binary_plan`.
var ( // PreparedStmtCount is exported for test. PreparedStmtCount int64 )
var SetCharsetVariables = []string{ CharacterSetClient, CharacterSetResults, }
SetCharsetVariables is the system variable names related to set charset statements.
var SetNamesVariables = []string{ CharacterSetClient, CharacterSetConnection, CharacterSetResults, }
SetNamesVariables is the system variable names related to set names statements.
Functions ¶
func BoolToOnOff ¶
BoolToOnOff returns the string representation of a bool, i.e. "ON/OFF"
func CheckSysVarIsRemoved ¶
CheckSysVarIsRemoved returns an error if the sysvar has been removed
func GetDDLErrorCountLimit ¶
func GetDDLErrorCountLimit() int64
GetDDLErrorCountLimit gets ddlErrorCountlimit size.
func GetDDLFlashbackConcurrency ¶
func GetDDLFlashbackConcurrency() int32
GetDDLFlashbackConcurrency gets ddlFlashbackConcurrency count.
func GetDDLReorgBatchSize ¶
func GetDDLReorgBatchSize() int32
GetDDLReorgBatchSize gets ddlReorgBatchSize.
func GetDDLReorgRowFormat ¶
func GetDDLReorgRowFormat() int64
GetDDLReorgRowFormat gets ddlReorgRowFormat version.
func GetDDLReorgWorkerCounter ¶
func GetDDLReorgWorkerCounter() int32
GetDDLReorgWorkerCounter gets ddlReorgWorkerCounter.
func GetMaxDeltaSchemaCount ¶
func GetMaxDeltaSchemaCount() int64
GetMaxDeltaSchemaCount gets maxDeltaSchemaCount size.
func GetStatusVars ¶
func GetStatusVars(vars *SessionVars) (map[string]*StatusVal, error)
GetStatusVars gets registered statistics status variables. TODO: Refactor this function to avoid repeated memory allocation / dealloc
func GetSysVars ¶
GetSysVars deep copies the sysVars list under a RWLock
func IsAdaptiveReplicaReadEnabled ¶
func IsAdaptiveReplicaReadEnabled() bool
IsAdaptiveReplicaReadEnabled returns whether adaptive closest replica read can be enabled.
func IsRemovedSysVar ¶
IsRemovedSysVar returns true if the sysvar has been removed
func OnOffToTrueFalse ¶
OnOffToTrueFalse convert "ON"/"OFF" to "true"/"false". In mysql.tidb the convention has been to store the string value "true"/"false", but sysvars use the convention ON/OFF.
func RegisterStatistics ¶
func RegisterStatistics(s Statistics)
RegisterStatistics registers statistics.
func RegisterSysVar ¶
func RegisterSysVar(sv *SysVar)
RegisterSysVar adds a sysvar to the SysVars list
func SetDDLErrorCountLimit ¶
func SetDDLErrorCountLimit(cnt int64)
SetDDLErrorCountLimit sets ddlErrorCountlimit size.
func SetDDLFlashbackConcurrency ¶
func SetDDLFlashbackConcurrency(cnt int32)
SetDDLFlashbackConcurrency sets ddlFlashbackConcurrency count. Sysvar validation enforces the range to already be correct.
func SetDDLReorgBatchSize ¶
func SetDDLReorgBatchSize(cnt int32)
SetDDLReorgBatchSize sets ddlReorgBatchSize size. Sysvar validation enforces the range to already be correct.
func SetDDLReorgRowFormat ¶
func SetDDLReorgRowFormat(format int64)
SetDDLReorgRowFormat sets ddlReorgRowFormat version.
func SetDDLReorgWorkerCounter ¶
func SetDDLReorgWorkerCounter(cnt int32)
SetDDLReorgWorkerCounter sets ddlReorgWorkerCounter count. Sysvar validation enforces the range to already be correct.
func SetEnableAdaptiveReplicaRead ¶
SetEnableAdaptiveReplicaRead set `enableAdaptiveReplicaRead` with given value. return true if the value is changed.
func SetMaxDeltaSchemaCount ¶
func SetMaxDeltaSchemaCount(cnt int64)
SetMaxDeltaSchemaCount sets maxDeltaSchemaCount size.
func SetSysVar ¶
SetSysVar sets a sysvar. In fact, SysVar is immutable. SetSysVar is implemented by register a new SysVar with the same name again. This will not propagate to the cluster, so it should only be used for instance scoped AUTO variables such as system_time_zone.
func TiDBOptOn ¶
TiDBOptOn could be used for all tidb session variable options, we use "ON"/1 to turn on those options.
func TiDBOptOnOffWarn ¶
TiDBOptOnOffWarn converts On/Off/Warn to an int. It is used for MultiStmtMode and NoopFunctionsMode
func TidbOptInt ¶
TidbOptInt converts a string to an int
func TidbOptInt64 ¶
TidbOptInt64 converts a string to an int64
func TidbOptUint64 ¶
TidbOptUint64 converts a string to an uint64.
func UnregisterStatistics ¶
func UnregisterStatistics(s Statistics)
UnregisterStatistics unregisters statistics.
func UnregisterSysVar ¶
func UnregisterSysVar(name string)
UnregisterSysVar removes a sysvar from the SysVars list currently only used in tests.
Types ¶
type AssertionLevel ¶
type AssertionLevel int
AssertionLevel controls the assertion that will be performed during transactions.
const ( // AssertionLevelOff indicates no assertion should be performed. AssertionLevelOff AssertionLevel = iota // AssertionLevelFast indicates assertions that doesn't affect performance should be performed. AssertionLevelFast // AssertionLevelStrict indicates full assertions should be performed, even if the performance might be slowed down. AssertionLevelStrict )
type BatchSize ¶
type BatchSize struct { // IndexJoinBatchSize is the batch size of a index lookup join. IndexJoinBatchSize int // IndexLookupSize is the number of handles for an index lookup task in index double read executor. IndexLookupSize int // InitChunkSize defines init row count of a Chunk during query execution. InitChunkSize int // MaxChunkSize defines max row count of a Chunk during query execution. MaxChunkSize int // MinPagingSize defines the min size used by the coprocessor paging protocol. MinPagingSize int // MinPagingSize defines the max size used by the coprocessor paging protocol. MaxPagingSize int }
BatchSize defines batch size values.
type ClusteredIndexDefMode ¶
type ClusteredIndexDefMode int
ClusteredIndexDefMode controls the default clustered property for primary key.
const ( // ClusteredIndexDefModeIntOnly indicates only single int primary key will default be clustered. ClusteredIndexDefModeIntOnly ClusteredIndexDefMode = 0 // ClusteredIndexDefModeOn indicates primary key will default be clustered. ClusteredIndexDefModeOn ClusteredIndexDefMode = 1 // ClusteredIndexDefModeOff indicates primary key will default be non-clustered. ClusteredIndexDefModeOff ClusteredIndexDefMode = 2 )
func TiDBOptEnableClustered ¶
func TiDBOptEnableClustered(opt string) ClusteredIndexDefMode
TiDBOptEnableClustered converts enable clustered options to ClusteredIndexDefMode.
type Concurrency ¶
type Concurrency struct { // ExecutorConcurrency is the number of concurrent worker for all executors. ExecutorConcurrency int // SourceAddr is the source address of request. Available in coprocessor ONLY. SourceAddr net.TCPAddr // contains filtered or unexported fields }
Concurrency defines concurrency values.
func (*Concurrency) DistSQLScanConcurrency ¶
func (c *Concurrency) DistSQLScanConcurrency() int
DistSQLScanConcurrency return the number of concurrent dist SQL scan worker.
func (*Concurrency) HashAggFinalConcurrency ¶
func (c *Concurrency) HashAggFinalConcurrency() int
HashAggFinalConcurrency return the number of concurrent hash aggregation final worker.
func (*Concurrency) HashAggPartialConcurrency ¶
func (c *Concurrency) HashAggPartialConcurrency() int
HashAggPartialConcurrency return the number of concurrent hash aggregation partial worker.
func (*Concurrency) HashJoinConcurrency ¶
func (c *Concurrency) HashJoinConcurrency() int
HashJoinConcurrency return the number of concurrent hash join outer worker.
func (*Concurrency) IndexLookupConcurrency ¶
func (c *Concurrency) IndexLookupConcurrency() int
IndexLookupConcurrency return the number of concurrent index lookup worker.
func (*Concurrency) IndexLookupJoinConcurrency ¶
func (c *Concurrency) IndexLookupJoinConcurrency() int
IndexLookupJoinConcurrency return the number of concurrent index lookup join inner worker.
func (*Concurrency) IndexMergeIntersectionConcurrency ¶
func (c *Concurrency) IndexMergeIntersectionConcurrency() int
IndexMergeIntersectionConcurrency return the number of concurrent process worker.
func (*Concurrency) IndexSerialScanConcurrency ¶
func (c *Concurrency) IndexSerialScanConcurrency() int
IndexSerialScanConcurrency return the number of concurrent index serial scan worker. This option is not sync with ExecutorConcurrency since it's used by Analyze table.
func (*Concurrency) MergeJoinConcurrency ¶
func (c *Concurrency) MergeJoinConcurrency() int
MergeJoinConcurrency return the number of concurrent merge join worker.
func (*Concurrency) ProjectionConcurrency ¶
func (c *Concurrency) ProjectionConcurrency() int
ProjectionConcurrency return the number of concurrent projection worker.
func (*Concurrency) SetDistSQLScanConcurrency ¶
func (c *Concurrency) SetDistSQLScanConcurrency(n int)
SetDistSQLScanConcurrency set the number of concurrent dist SQL scan worker.
func (*Concurrency) SetHashAggFinalConcurrency ¶
func (c *Concurrency) SetHashAggFinalConcurrency(n int)
SetHashAggFinalConcurrency set the number of concurrent hash aggregation final worker.
func (*Concurrency) SetHashAggPartialConcurrency ¶
func (c *Concurrency) SetHashAggPartialConcurrency(n int)
SetHashAggPartialConcurrency set the number of concurrent hash aggregation partial worker.
func (*Concurrency) SetHashJoinConcurrency ¶
func (c *Concurrency) SetHashJoinConcurrency(n int)
SetHashJoinConcurrency set the number of concurrent hash join outer worker.
func (*Concurrency) SetIndexLookupConcurrency ¶
func (c *Concurrency) SetIndexLookupConcurrency(n int)
SetIndexLookupConcurrency set the number of concurrent index lookup worker.
func (*Concurrency) SetIndexLookupJoinConcurrency ¶
func (c *Concurrency) SetIndexLookupJoinConcurrency(n int)
SetIndexLookupJoinConcurrency set the number of concurrent index lookup join inner worker.
func (*Concurrency) SetIndexMergeIntersectionConcurrency ¶
func (c *Concurrency) SetIndexMergeIntersectionConcurrency(n int)
SetIndexMergeIntersectionConcurrency set the number of concurrent intersection process worker.
func (*Concurrency) SetIndexSerialScanConcurrency ¶
func (c *Concurrency) SetIndexSerialScanConcurrency(n int)
SetIndexSerialScanConcurrency set the number of concurrent index serial scan worker.
func (*Concurrency) SetMergeJoinConcurrency ¶
func (c *Concurrency) SetMergeJoinConcurrency(n int)
SetMergeJoinConcurrency set the number of concurrent merge join worker.
func (*Concurrency) SetProjectionConcurrency ¶
func (c *Concurrency) SetProjectionConcurrency(n int)
SetProjectionConcurrency set the number of concurrent projection worker.
func (*Concurrency) SetStreamAggConcurrency ¶
func (c *Concurrency) SetStreamAggConcurrency(n int)
SetStreamAggConcurrency set the number of concurrent stream aggregation worker.
func (*Concurrency) SetWindowConcurrency ¶
func (c *Concurrency) SetWindowConcurrency(n int)
SetWindowConcurrency set the number of concurrent window worker.
func (*Concurrency) StreamAggConcurrency ¶
func (c *Concurrency) StreamAggConcurrency() int
StreamAggConcurrency return the number of concurrent stream aggregation worker.
func (*Concurrency) UnionConcurrency ¶
func (c *Concurrency) UnionConcurrency() int
UnionConcurrency return the num of concurrent union worker.
func (*Concurrency) WindowConcurrency ¶
func (c *Concurrency) WindowConcurrency() int
WindowConcurrency return the number of concurrent window worker.
type ConnectionInfo ¶
type ConnectionInfo struct { ConnectionID uint64 ConnectionType string Host string ClientIP string ClientPort string ServerID int ServerIP string ServerPort int Duration float64 User string ServerOSLoginUser string OSVersion string ClientVersion string ServerVersion string SSLVersion string PID int DB string }
ConnectionInfo presents the connection information, which is mainly used by audit logs.
func (*ConnectionInfo) IsSecureTransport ¶
func (connInfo *ConnectionInfo) IsSecureTransport() bool
IsSecureTransport checks whether the connection is secure.
type GlobalVarAccessor ¶
type GlobalVarAccessor interface { // GetGlobalSysVar gets the global system variable value for name. GetGlobalSysVar(name string) (string, error) // SetGlobalSysVar sets the global system variable name to value. SetGlobalSysVar(ctx context.Context, name string, value string) error // SetGlobalSysVarOnly sets the global system variable without calling the validation function or updating aliases. SetGlobalSysVarOnly(ctx context.Context, name string, value string, updateLocal bool) error // GetTiDBTableValue gets a value from mysql.tidb for the key 'name' GetTiDBTableValue(name string) (string, error) // SetTiDBTableValue sets a value+comment for the mysql.tidb key 'name' SetTiDBTableValue(name, value, comment string) error }
GlobalVarAccessor is the interface for accessing global scope system and status variables.
type HookContext ¶
HookContext contains the necessary variables for executing set/get hook
type JSONSQLWarnForSlowLog ¶
type JSONSQLWarnForSlowLog struct { Level string Message string // IsExtra means this SQL Warn is expected to be recorded only under some conditions (like in EXPLAIN) and should // haven't been recorded as a warning now, but we recorded it anyway to help diagnostics. IsExtra bool `json:",omitempty"` }
JSONSQLWarnForSlowLog helps to print the SQLWarn through the slow log in JSON format.
type MemQuota ¶
type MemQuota struct { // MemQuotaQuery defines the memory quota for a query. MemQuotaQuery int64 // MemQuotaApplyCache defines the memory capacity for apply cache. MemQuotaApplyCache int64 }
MemQuota defines memory quota values.
type MockGlobalAccessor ¶
type MockGlobalAccessor struct { SessionVars *SessionVars // can be overwritten if needed for correctness. // contains filtered or unexported fields }
MockGlobalAccessor implements GlobalVarAccessor interface. it's used in tests
func NewMockGlobalAccessor ¶
func NewMockGlobalAccessor() *MockGlobalAccessor
NewMockGlobalAccessor implements GlobalVarAccessor interface.
func NewMockGlobalAccessor4Tests ¶
func NewMockGlobalAccessor4Tests() *MockGlobalAccessor
NewMockGlobalAccessor4Tests creates a new MockGlobalAccessor for use in the testsuite. It behaves like the real GlobalVarAccessor and has a list of sessionvars. Because we use the real GlobalVarAccessor outside of tests, this is unsafe to use by default (performance regression).
func (*MockGlobalAccessor) GetGlobalSysVar ¶
func (m *MockGlobalAccessor) GetGlobalSysVar(name string) (string, error)
GetGlobalSysVar implements GlobalVarAccessor.GetGlobalSysVar interface.
func (*MockGlobalAccessor) GetTiDBTableValue ¶
func (m *MockGlobalAccessor) GetTiDBTableValue(name string) (string, error)
GetTiDBTableValue implements GlobalVarAccessor.GetTiDBTableValue interface.
func (*MockGlobalAccessor) SetGlobalSysVar ¶
func (m *MockGlobalAccessor) SetGlobalSysVar(ctx context.Context, name string, value string) (err error)
SetGlobalSysVar implements GlobalVarAccessor.SetGlobalSysVar interface.
func (*MockGlobalAccessor) SetGlobalSysVarOnly ¶
func (m *MockGlobalAccessor) SetGlobalSysVarOnly(ctx context.Context, name string, value string, _ bool) error
SetGlobalSysVarOnly implements GlobalVarAccessor.SetGlobalSysVarOnly interface.
func (*MockGlobalAccessor) SetTiDBTableValue ¶
func (m *MockGlobalAccessor) SetTiDBTableValue(name, value, comment string) error
SetTiDBTableValue implements GlobalVarAccessor.SetTiDBTableValue interface.
type PartitionPruneMode ¶
type PartitionPruneMode string
PartitionPruneMode presents the prune mode used.
const ( // Static indicates only prune at plan phase. Static PartitionPruneMode = "static" // Dynamic indicates only prune at execute phase. Dynamic PartitionPruneMode = "dynamic" // StaticOnly is out-of-date. StaticOnly PartitionPruneMode = "static-only" // DynamicOnly is out-of-date. DynamicOnly PartitionPruneMode = "dynamic-only" // StaticButPrepareDynamic is out-of-date. StaticButPrepareDynamic PartitionPruneMode = "static-collect-dynamic" )
func (PartitionPruneMode) Update ¶
func (p PartitionPruneMode) Update() PartitionPruneMode
Update updates out-of-date PruneMode.
func (PartitionPruneMode) Valid ¶
func (p PartitionPruneMode) Valid() bool
Valid indicate PruneMode is validated.
type PreparedParams ¶
PreparedParams contains the parameters of the current prepared statement when executing it.
func (PreparedParams) String ¶
func (pps PreparedParams) String() string
type ReadConsistencyLevel ¶
type ReadConsistencyLevel string
ReadConsistencyLevel is the level of read consistency.
const ( // ReadConsistencyStrict means read by strict consistency, default value. ReadConsistencyStrict ReadConsistencyLevel = "strict" // ReadConsistencyWeak means read can be weak consistency. ReadConsistencyWeak ReadConsistencyLevel = "weak" )
func (ReadConsistencyLevel) IsWeak ¶
func (r ReadConsistencyLevel) IsWeak() bool
IsWeak returns true only if it's a weak-consistency read.
type RetryInfo ¶
type RetryInfo struct { Retrying bool DroppedPreparedStmtIDs []uint32 LastRcReadTS uint64 // contains filtered or unexported fields }
RetryInfo saves retry information.
func (*RetryInfo) AddAutoIncrementID ¶
AddAutoIncrementID adds id to autoIncrementIDs.
func (*RetryInfo) AddAutoRandomID ¶
AddAutoRandomID adds id to autoRandomIDs.
func (*RetryInfo) GetCurrAutoIncrementID ¶
GetCurrAutoIncrementID gets current autoIncrementID.
func (*RetryInfo) GetCurrAutoRandomID ¶
GetCurrAutoRandomID gets current AutoRandomID.
func (*RetryInfo) ResetOffset ¶
func (r *RetryInfo) ResetOffset()
ResetOffset resets the current retry offset.
type ReuseChunkPool ¶
ReuseChunkPool save Alloc object
type RewritePhaseInfo ¶
type RewritePhaseInfo struct { // DurationRewrite is the duration of rewriting the SQL. DurationRewrite time.Duration // DurationPreprocessSubQuery is the duration of pre-processing sub-queries. DurationPreprocessSubQuery time.Duration // PreprocessSubQueries is the number of pre-processed sub-queries. PreprocessSubQueries int }
RewritePhaseInfo records some information about the rewrite phase
func (*RewritePhaseInfo) Reset ¶
func (r *RewritePhaseInfo) Reset()
Reset resets all fields in RewritePhaseInfo.
type SavepointRecord ¶
type SavepointRecord struct { // name is the name of the savepoint Name string // MemDBCheckpoint is the transaction's memdb checkpoint. MemDBCheckpoint *tikv.MemDBCheckpoint // TxnCtxSavepoint is the savepoint of TransactionContext TxnCtxSavepoint TxnCtxNeedToRestore }
SavepointRecord indicates a transaction's savepoint record.
type ScopeFlag ¶
type ScopeFlag uint8
ScopeFlag is for system variable whether can be changed in global/session dynamically or not.
type SequenceState ¶
type SequenceState struct {
// contains filtered or unexported fields
}
SequenceState cache all sequence's latest value accessed by lastval() builtins. It's a session scoped variable, and all public methods of SequenceState are currently-safe.
func NewSequenceState ¶
func NewSequenceState() *SequenceState
NewSequenceState creates a SequenceState.
func (*SequenceState) GetAllStates ¶
func (ss *SequenceState) GetAllStates() map[int64]int64
GetAllStates returns a copied latestValueMap.
func (*SequenceState) GetLastValue ¶
func (ss *SequenceState) GetLastValue(sequenceID int64) (int64, bool, error)
GetLastValue will return last value of the specified sequenceID, bool(true) indicates the sequenceID is not in the cache map and NULL will be returned.
func (*SequenceState) SetAllStates ¶
func (ss *SequenceState) SetAllStates(latestValueMap map[int64]int64)
SetAllStates sets latestValueMap as a whole.
func (*SequenceState) UpdateState ¶
func (ss *SequenceState) UpdateState(sequenceID, value int64)
UpdateState will update the last value of specified sequenceID in a session.
type SessionVars ¶
type SessionVars struct { Concurrency MemQuota BatchSize // DMLBatchSize indicates the number of rows batch-committed for a statement. // It will be used when using LOAD DATA or BatchInsert or BatchDelete is on. DMLBatchSize int RetryLimit int64 DisableTxnAutoRetry bool // SysWarningCount is the system variable "warning_count", because it is on the hot path, so we extract it from the systems SysWarningCount int // SysErrorCount is the system variable "error_count", because it is on the hot path, so we extract it from the systems SysErrorCount uint16 // PreparedStmts stores prepared statement. PreparedStmts map[uint32]interface{} PreparedStmtNameToID map[string]uint32 // PreparedParams params for prepared statements PreparedParams PreparedParams LastUpdateTime4PC types.Time // ActiveRoles stores active roles for current user ActiveRoles []*auth.RoleIdentity RetryInfo *RetryInfo // TxnCtx Should be reset on transaction finished. TxnCtx *TransactionContext // TxnCtxMu is used to protect TxnCtx. TxnCtxMu sync.Mutex // TxnManager is used to manage txn context in session TxnManager interface{} // KVVars is the variables for KV storage. KVVars *tikvstore.Variables // Status stands for the session status. e.g. in transaction or not, auto commit is on or off, and so on. Status uint16 // ClientCapability is client's capability. ClientCapability uint32 // TLSConnectionState is the TLS connection state (nil if not using TLS). TLSConnectionState *tls.ConnectionState // ConnectionID is the connection id of the current session. ConnectionID uint64 // PlanID is the unique id of logical and physical plan. PlanID int // PlanColumnID is the unique id for column when building plan. PlanColumnID int64 // MapHashCode2UniqueID4ExtendedCol map the expr's hash code to specified unique ID. MapHashCode2UniqueID4ExtendedCol map[string]int // User is the user identity with which the session login. User *auth.UserIdentity // Port is the port of the connected socket Port string // CurrentDB is the default database of this session. CurrentDB string // CurrentDBChanged indicates if the CurrentDB has been updated, and if it is we should print it into // the slow log to make it be compatible with MySQL, https://github.com/lemon-mint/tidb/v7/issues/17846. CurrentDBChanged bool // StrictSQLMode indicates if the session is in strict mode. StrictSQLMode bool // CommonGlobalLoaded indicates if common global variable has been loaded for this session. CommonGlobalLoaded bool // InRestrictedSQL indicates if the session is handling restricted SQL execution. InRestrictedSQL bool // SnapshotTS is used for reading history data. For simplicity, SnapshotTS only supports distsql request. SnapshotTS uint64 // TxnReadTS is used for staleness transaction, it provides next staleness transaction startTS. TxnReadTS *TxnReadTS // SnapshotInfoschema is used with SnapshotTS, when the schema version at snapshotTS less than current schema // version, we load an old version schema for query. SnapshotInfoschema interface{} // BinlogClient is used to write binlog. BinlogClient *pumpcli.PumpsClient // GlobalVarsAccessor is used to set and get global variables. GlobalVarsAccessor GlobalVarAccessor // LastFoundRows is the number of found rows of last query statement LastFoundRows uint64 // StmtCtx holds variables for current executing statement. StmtCtx *stmtctx.StatementContext // RefCountOfStmtCtx indicates the reference count of StmtCtx. When the // StmtCtx is accessed by other sessions, e.g. oom-alarm-handler/expensive-query-handler, add one first. // Note: this variable should be accessed and updated by atomic operations. RefCountOfStmtCtx stmtctx.ReferenceCount // AllowAggPushDown can be set to false to forbid aggregation push down. AllowAggPushDown bool // AllowCartesianBCJ means allow broadcast CARTESIAN join, 0 means not allow, 1 means allow broadcast CARTESIAN join // but the table size should under the broadcast threshold, 2 means allow broadcast CARTESIAN join even if the table // size exceeds the broadcast threshold AllowCartesianBCJ int // MPPOuterJoinFixedBuildSide means in MPP plan, always use right(left) table as build side for left(right) out join MPPOuterJoinFixedBuildSide bool // AllowDistinctAggPushDown can be set true to allow agg with distinct push down to tikv/tiflash. AllowDistinctAggPushDown bool // EnableSkewDistinctAgg can be set true to allow skew distinct aggregate rewrite EnableSkewDistinctAgg bool // Enable3StageDistinctAgg indicates whether to allow 3 stage distinct aggregate Enable3StageDistinctAgg bool // MultiStatementMode permits incorrect client library usage. Not recommended to be turned on. MultiStatementMode int // AllowWriteRowID variable is currently not recommended to be turned on. AllowWriteRowID bool // AllowBatchCop means if we should send batch coprocessor to TiFlash. Default value is 1, means to use batch cop in case of aggregation and join. // Value set to 2 means to force to send batch cop for any query. Value set to 0 means never use batch cop. AllowBatchCop int // HashExchangeWithNewCollation means if we support hash exchange when new collation is enabled. // Default value is `true`, means support hash exchange when new collation is enabled. // Value set to `false` means not use hash exchange when new collation is enabled. HashExchangeWithNewCollation bool // TiFlashMaxThreads is the maximum number of threads to execute the request which is pushed down to tiflash. // Default value is -1, means it will not be pushed down to tiflash. // If the value is bigger than -1, it will be pushed down to tiflash and used to create db context in tiflash. TiFlashMaxThreads int64 // TiDBAllowAutoRandExplicitInsert indicates whether explicit insertion on auto_random column is allowed. AllowAutoRandExplicitInsert bool // BroadcastJoinThresholdSize is used to limit the size of smaller table. // It's unit is bytes, if the size of small table is larger than it, we will not use bcj. BroadcastJoinThresholdSize int64 // BroadcastJoinThresholdCount is used to limit the total count of smaller table. // If we can't estimate the size of one side of join child, we will check if its row number exceeds this limitation. BroadcastJoinThresholdCount int64 // LimitPushDownThreshold determines if push Limit or TopN down to TiKV forcibly. LimitPushDownThreshold int64 // CorrelationThreshold is the guard to enable row count estimation using column order correlation. CorrelationThreshold float64 // EnableCorrelationAdjustment is used to indicate if correlation adjustment is enabled. EnableCorrelationAdjustment bool // CorrelationExpFactor is used to control the heuristic approach of row count estimation when CorrelationThreshold is not met. CorrelationExpFactor int // CopTiFlashConcurrencyFactor is the concurrency number of computation in tiflash coprocessor. CopTiFlashConcurrencyFactor float64 // CurrInsertValues is used to record current ValuesExpr's values. // See http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_values CurrInsertValues chunk.Row // In https://github.com/lemon-mint/tidb/v7/issues/14164, we can see that MySQL can enter the column that is not in the insert's SELECT's output. // We store the extra columns in this variable. CurrInsertBatchExtraCols [][]types.Datum // Per-connection time zones. Each client that connects has its own time zone setting, given by the session time_zone variable. // See https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html TimeZone *time.Location SQLMode mysql.SQLMode // AutoIncrementIncrement and AutoIncrementOffset indicates the autoID's start value and increment. AutoIncrementIncrement int AutoIncrementOffset int // SkipASCIICheck check on input value. SkipASCIICheck bool // SkipUTF8Check check on input value. SkipUTF8Check bool // BatchInsert indicates if we should split insert data into multiple batches. BatchInsert bool // BatchDelete indicates if we should split delete data into multiple batches. BatchDelete bool // BatchCommit indicates if we should split the transaction into multiple batches. BatchCommit bool // IDAllocator is provided by kvEncoder, if it is provided, we will use it to alloc auto id instead of using // Table.alloc. IDAllocator autoid.Allocator // OptimizerSelectivityLevel defines the level of the selectivity estimation in plan. OptimizerSelectivityLevel int // OptimizerEnableNewOnlyFullGroupByCheck enables the new only_full_group_by check which is implemented by maintaining functional dependency. OptimizerEnableNewOnlyFullGroupByCheck bool // EnableOuterJoinWithJoinReorder enables TiDB to involve the outer join into the join reorder. EnableOuterJoinReorder bool // OptimizerEnableNAAJ enables TiDB to use null-aware anti join. OptimizerEnableNAAJ bool // EnableTablePartition enables table partition feature. EnableTablePartition string // EnableListTablePartition enables list table partition feature. EnableListTablePartition bool // EnableCascadesPlanner enables the cascades planner. EnableCascadesPlanner bool // EnableWindowFunction enables the window function. EnableWindowFunction bool // EnablePipelinedWindowExec enables executing window functions in a pipelined manner. EnablePipelinedWindowExec bool // AllowProjectionPushDown enables pushdown projection on TiKV. AllowProjectionPushDown bool // EnableStrictDoubleTypeCheck enables table field double type check. EnableStrictDoubleTypeCheck bool // EnableVectorizedExpression enables the vectorized expression evaluation. EnableVectorizedExpression bool // DDLReorgPriority is the operation priority of adding indices. DDLReorgPriority int // EnableAutoIncrementInGenerated is used to control whether to allow auto incremented columns in generated columns. EnableAutoIncrementInGenerated bool // EnablePointGetCache is used to cache value for point get for read only scenario. EnablePointGetCache bool // PlacementMode the placement mode we use // strict: Check placement settings strictly in ddl operations // ignore: Ignore all placement settings in ddl operations PlacementMode string // WaitSplitRegionFinish defines the split region behaviour is sync or async. WaitSplitRegionFinish bool // WaitSplitRegionTimeout defines the split region timeout. WaitSplitRegionTimeout uint64 // EnableChunkRPC indicates whether the coprocessor request can use chunk API. EnableChunkRPC bool // ConstraintCheckInPlace indicates whether to check the constraint when the SQL executing. ConstraintCheckInPlace bool // CommandValue indicates which command current session is doing. CommandValue uint32 // TiDBOptJoinReorderThreshold defines the minimal number of join nodes // to use the greedy join reorder algorithm. TiDBOptJoinReorderThreshold int // SlowQueryFile indicates which slow query log file for SLOW_QUERY table to parse. SlowQueryFile string // EnableFastAnalyze indicates whether to take fast analyze. EnableFastAnalyze bool // TxnMode indicates should be pessimistic or optimistic. TxnMode string // LowResolutionTSO is used for reading data with low resolution TSO which is updated once every two seconds. LowResolutionTSO bool // MaxExecutionTime is the timeout for select statement, in milliseconds. // If the value is 0, timeouts are not enabled. // See https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_execution_time MaxExecutionTime uint64 // Killed is a flag to indicate that this query is killed. Killed uint32 // ConnectionInfo indicates current connection info used by current session. ConnectionInfo *ConnectionInfo // NoopFuncsMode allows OFF/ON/WARN values as 0/1/2. NoopFuncsMode int // StartTime is the start time of the last query. StartTime time.Time // DurationParse is the duration of parsing SQL string to AST of the last query. DurationParse time.Duration // DurationCompile is the duration of compiling AST to execution plan of the last query. DurationCompile time.Duration // RewritePhaseInfo records all information about the rewriting phase. RewritePhaseInfo // DurationOptimization is the duration of optimizing a query. DurationOptimization time.Duration // DurationWaitTS is the duration of waiting for a snapshot TS DurationWaitTS time.Duration // PrevStmt is used to store the previous executed statement in the current session. PrevStmt fmt.Stringer // AllowRemoveAutoInc indicates whether a user can drop the auto_increment column attribute or not. AllowRemoveAutoInc bool // UsePlanBaselines indicates whether we will use plan baselines to adjust plan. UsePlanBaselines bool // EvolvePlanBaselines indicates whether we will evolve the plan baselines. EvolvePlanBaselines bool // EnableExtendedStats indicates whether we enable the extended statistics feature. EnableExtendedStats bool // ReplicaClosestReadThreshold is the minimum response body size that a cop request should be sent to the closest replica. // this variable only take effect when `tidb_follower_read` = 'closest-adaptive' ReplicaClosestReadThreshold int64 // IsolationReadEngines is used to isolation read, tidb only read from the stores whose engine type is in the engines. IsolationReadEngines map[kv.StoreType]struct{} PlannerSelectBlockAsName []ast.HintTable // LockWaitTimeout is the duration waiting for pessimistic lock in milliseconds LockWaitTimeout int64 // MetricSchemaStep indicates the step when query metric schema. MetricSchemaStep int64 // CDCWriteSource indicates the following data is written by TiCDC if it is not 0. CDCWriteSource uint64 // MetricSchemaRangeDuration indicates the step when query metric schema. MetricSchemaRangeDuration int64 // Some data of cluster-level memory tables will be retrieved many times in different inspection rules, // and the cost of retrieving some data is expensive. We use the `TableSnapshot` to cache those data // and obtain them lazily, and provide a consistent view of inspection tables for each inspection rules. // All cached snapshots will be released at the end of retrieving InspectionTableCache map[string]TableSnapshot // RowEncoder is reused in session for encode row data. RowEncoder rowcodec.Encoder // SequenceState cache all sequence's latest value accessed by lastval() builtins. It's a session scoped // variable, and all public methods of SequenceState are currently-safe. SequenceState *SequenceState // WindowingUseHighPrecision determines whether to compute window operations without loss of precision. // see https://dev.mysql.com/doc/refman/8.0/en/window-function-optimization.html for more details. WindowingUseHighPrecision bool // FoundInPlanCache indicates whether this statement was found in plan cache. FoundInPlanCache bool // PrevFoundInPlanCache indicates whether the last statement was found in plan cache. PrevFoundInPlanCache bool // FoundInBinding indicates whether the execution plan is matched with the hints in the binding. FoundInBinding bool // PrevFoundInBinding indicates whether the last execution plan is matched with the hints in the binding. PrevFoundInBinding bool // OptimizerUseInvisibleIndexes indicates whether optimizer can use invisible index OptimizerUseInvisibleIndexes bool // SelectLimit limits the max counts of select statement's output SelectLimit uint64 // EnableClusteredIndex indicates whether to enable clustered index when creating a new table. EnableClusteredIndex ClusteredIndexDefMode // PresumeKeyNotExists indicates lazy existence checking is enabled. PresumeKeyNotExists bool // EnableParallelApply indicates that thether to use parallel apply. EnableParallelApply bool // EnableRedactLog indicates that whether redact log. EnableRedactLog bool // ShardAllocateStep indicates the max size of continuous rowid shard in one transaction. ShardAllocateStep int64 // LastTxnInfo keeps track the info of last committed transaction. LastTxnInfo string // LastQueryInfo keeps track the info of last query. LastQueryInfo sessionstates.QueryInfo // LastDDLInfo keeps track the info of last DDL. LastDDLInfo sessionstates.LastDDLInfo // PartitionPruneMode indicates how and when to prune partitions. PartitionPruneMode atomic2.String // TxnScope indicates the scope of the transactions. It should be `global` or equal to the value of key `zone` in config.Labels. TxnScope kv.TxnScopeVar // EnabledRateLimitAction indicates whether enabled ratelimit action during coprocessor EnabledRateLimitAction bool // EnableAsyncCommit indicates whether to enable the async commit feature. EnableAsyncCommit bool // Enable1PC indicates whether to enable the one-phase commit feature. Enable1PC bool // GuaranteeLinearizability indicates whether to guarantee linearizability GuaranteeLinearizability bool // AnalyzeVersion indicates how TiDB collect and use analyzed statistics. AnalyzeVersion int // EnableIndexMergeJoin indicates whether to enable index merge join. EnableIndexMergeJoin bool // TrackAggregateMemoryUsage indicates whether to track the memory usage of aggregate function. TrackAggregateMemoryUsage bool // TiDBEnableExchangePartition indicates whether to enable exchange partition TiDBEnableExchangePartition bool // AllowFallbackToTiKV indicates the engine types whose unavailability triggers fallback to TiKV. // Now we only support TiFlash. AllowFallbackToTiKV map[kv.StoreType]struct{} // CTEMaxRecursionDepth indicates The common table expression (CTE) maximum recursion depth. // see https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_cte_max_recursion_depth CTEMaxRecursionDepth int // The temporary table size threshold, which is different from MySQL. See https://github.com/lemon-mint/tidb/v7/issues/28691. TMPTableSize int64 // EnableStableResultMode if stabilize query results. EnableStableResultMode bool // EnablePseudoForOutdatedStats if using pseudo for outdated stats EnablePseudoForOutdatedStats bool // RegardNULLAsPoint if regard NULL as Point RegardNULLAsPoint bool // LocalTemporaryTables is *infoschema.LocalTemporaryTables, use interface to avoid circle dependency. // It's nil if there is no local temporary table. LocalTemporaryTables interface{} // TemporaryTableData stores committed kv values for temporary table for current session. TemporaryTableData TemporaryTableData // MPPStoreFailTTL indicates the duration that protect TiDB from sending task to a new recovered TiFlash. MPPStoreFailTTL string // ReadStaleness indicates the staleness duration for the following query ReadStaleness time.Duration // Rng stores the rand_seed1 and rand_seed2 for Rand() function Rng *mathutil.MysqlRng // EnablePaging indicates whether enable paging in coprocessor requests. EnablePaging bool // EnableLegacyInstanceScope says if SET SESSION can be used to set an instance // scope variable. The default is TRUE. EnableLegacyInstanceScope bool // ReadConsistency indicates the read consistency requirement. ReadConsistency ReadConsistencyLevel // StatsLoadSyncWait indicates how long to wait for stats load before timeout. StatsLoadSyncWait int64 // SysdateIsNow indicates whether Sysdate is an alias of Now function SysdateIsNow bool // EnableMutationChecker indicates whether to check data consistency for mutations EnableMutationChecker bool // AssertionLevel controls how strict the assertions on data mutations should be. AssertionLevel AssertionLevel // IgnorePreparedCacheCloseStmt controls if ignore the close-stmt command for prepared statement. IgnorePreparedCacheCloseStmt bool // EnableNewCostInterface is a internal switch to indicates whether to use the new cost calculation interface. EnableNewCostInterface bool // CostModelVersion is a internal switch to indicates the Cost Model Version. CostModelVersion int // IndexJoinDoubleReadPenaltyCostRate indicates whether to add some penalty cost to IndexJoin and how much of it. IndexJoinDoubleReadPenaltyCostRate float64 // BatchPendingTiFlashCount shows the threshold of pending TiFlash tables when batch adding. BatchPendingTiFlashCount int // RcWriteCheckTS indicates whether some special write statements don't get latest tso from PD at RC RcWriteCheckTS bool // RemoveOrderbyInSubquery indicates whether to remove ORDER BY in subquery. RemoveOrderbyInSubquery bool // NonTransactionalIgnoreError indicates whether to ignore error in non-transactional statements. // When set to false, returns immediately when it meets the first error. NonTransactionalIgnoreError bool // MaxAllowedPacket indicates the maximum size of a packet for the MySQL protocol. MaxAllowedPacket uint64 // TiFlash related optimization, only for MPP. TiFlashFineGrainedShuffleStreamCount int64 TiFlashFineGrainedShuffleBatchSize uint64 // RequestSourceType is the type of inner request. RequestSourceType string // MemoryDebugModeMinHeapInUse indicated the minimum heapInUse threshold that triggers the memoryDebugMode. MemoryDebugModeMinHeapInUse int64 // MemoryDebugModeAlarmRatio indicated the allowable bias ratio of memory tracking accuracy check. // When `(memory trakced by tidb) * (1+MemoryDebugModeAlarmRatio) < actual heapInUse`, an alarm log will be recorded. MemoryDebugModeAlarmRatio int64 // EnableAnalyzeSnapshot indicates whether to read data on snapshot when collecting statistics. // When it is false, ANALYZE reads the latest data. // When it is true, ANALYZE reads data on the snapshot at the beginning of ANALYZE. EnableAnalyzeSnapshot bool // DefaultStrMatchSelectivity adjust the estimation strategy for string matching expressions that can't be estimated by building into range. // when > 0: it's the selectivity for the expression. // when = 0: try to use TopN to evaluate the like expression to estimate the selectivity. DefaultStrMatchSelectivity float64 // TiFlashFastScan indicates whether use fast scan in TiFlash TiFlashFastScan bool // PrimaryKeyRequired indicates if sql_require_primary_key sysvar is set PrimaryKeyRequired bool // EnablePreparedPlanCache indicates whether to enable prepared plan cache. EnablePreparedPlanCache bool // PreparedPlanCacheSize controls the size of prepared plan cache. PreparedPlanCacheSize uint64 // PreparedPlanCacheMonitor indicates whether to enable prepared plan cache monitor. EnablePreparedPlanCacheMemoryMonitor bool // EnablePlanCacheForParamLimit controls whether the prepare statement with parameterized limit can be cached EnablePlanCacheForParamLimit bool // EnableNonPreparedPlanCache indicates whether to enable non-prepared plan cache. EnableNonPreparedPlanCache bool // NonPreparedPlanCacheSize controls the size of non-prepared plan cache. NonPreparedPlanCacheSize uint64 // ConstraintCheckInPlacePessimistic controls whether to skip the locking of some keys in pessimistic transactions. // Postpone the conflict check and constraint check to prewrite or later pessimistic locking requests. ConstraintCheckInPlacePessimistic bool // EnableTiFlashReadForWriteStmt indicates whether to enable TiFlash to read for write statements. EnableTiFlashReadForWriteStmt bool // EnableUnsafeSubstitute indicates whether to enable generate column takes unsafe substitute. EnableUnsafeSubstitute bool // ForeignKeyChecks indicates whether to enable foreign key constraint check. ForeignKeyChecks bool // RangeMaxSize is the max memory limit for ranges. When the optimizer estimates that the memory usage of complete // ranges would exceed the limit, it chooses less accurate ranges such as full range. 0 indicates that there is no // memory limit for ranges. RangeMaxSize int64 // LastPlanReplayerToken indicates the last plan replayer token LastPlanReplayerToken string // AnalyzePartitionConcurrency indicates concurrency for partitions in Analyze AnalyzePartitionConcurrency int // AnalyzePartitionMergeConcurrency indicates concurrency for merging partition stats AnalyzePartitionMergeConcurrency int // EnableExternalTSRead indicates whether to enable read through external ts EnableExternalTSRead bool HookContext // MemTracker indicates the memory tracker of current session. MemTracker *memory.Tracker // MemDBDBFootprint tracks the memory footprint of memdb, and is attached to `MemTracker` MemDBFootprint *memory.Tracker DiskTracker *memory.Tracker // OptPrefixIndexSingleScan indicates whether to do some optimizations to avoid double scan for prefix index. // When set to true, `col is (not) null`(`col` is index prefix column) is regarded as index filter rather than table filter. OptPrefixIndexSingleScan bool // ChunkPool Several chunks and columns are cached ChunkPool ReuseChunkPool // EnableReuseCheck indicates request chunk whether use chunk alloc EnableReuseCheck bool // EnablePlanReplayerCapture indicates whether enabled plan replayer capture EnablePlanReplayerCapture bool // EnablePlanReplayedContinuesCapture indicates whether enabled plan replayer continues capture EnablePlanReplayedContinuesCapture bool // PlanReplayerFinishedTaskKey used to record the finished plan replayer task key in order not to record the // duplicate task in plan replayer continues capture PlanReplayerFinishedTaskKey map[replayer.PlanReplayerTaskKey]struct{} // StoreBatchSize indicates the batch size limit of store batch, set this field to 0 to disable store batch. StoreBatchSize int // Resource group name ResourceGroupName string // ProtectedTSList holds a list of timestamps that should delay GC. ProtectedTSList protectedTSList // PessimisticTransactionAggressiveLocking controls whether aggressive locking for pessimistic transaction // is enabled. PessimisticTransactionAggressiveLocking bool // contains filtered or unexported fields }
SessionVars is to handle user-defined or global variables in the current session.
func NewSessionVars ¶
func NewSessionVars(hctx HookContext) *SessionVars
NewSessionVars creates a session vars object.
func (*SessionVars) AddNonPreparedPlanCacheStmt ¶
func (s *SessionVars) AddNonPreparedPlanCacheStmt(sql string, stmt interface{})
AddNonPreparedPlanCacheStmt adds this PlanCacheStmt into non-preapred plan-cache stmt cache
func (*SessionVars) AddPlanReplayerFinishedTaskKey ¶
func (s *SessionVars) AddPlanReplayerFinishedTaskKey(key replayer.PlanReplayerTaskKey)
AddPlanReplayerFinishedTaskKey record finished task key in session
func (*SessionVars) AddPreparedStmt ¶
func (s *SessionVars) AddPreparedStmt(stmtID uint32, stmt interface{}) error
AddPreparedStmt adds prepareStmt to current session and count in global.
func (*SessionVars) AllocNewPlanID ¶
func (s *SessionVars) AllocNewPlanID() int
AllocNewPlanID alloc new ID
func (*SessionVars) AllocPlanColumnID ¶
func (s *SessionVars) AllocPlanColumnID() int64
AllocPlanColumnID allocates column id for plan.
func (*SessionVars) BuildParserConfig ¶
func (s *SessionVars) BuildParserConfig() parser.ParserConfig
BuildParserConfig generate parser.ParserConfig for initial parser
func (*SessionVars) CheckAndGetTxnScope ¶
func (s *SessionVars) CheckAndGetTxnScope() string
CheckAndGetTxnScope will return the transaction scope we should use in the current session.
func (*SessionVars) CheckPlanReplayerFinishedTaskKey ¶
func (s *SessionVars) CheckPlanReplayerFinishedTaskKey(key replayer.PlanReplayerTaskKey) bool
CheckPlanReplayerFinishedTaskKey check whether the key exists
func (*SessionVars) CleanBuffers ¶
func (s *SessionVars) CleanBuffers()
CleanBuffers cleans the temporary bufs
func (*SessionVars) CleanupTxnReadTSIfUsed ¶
func (s *SessionVars) CleanupTxnReadTSIfUsed()
CleanupTxnReadTSIfUsed cleans txnReadTS if used
func (*SessionVars) ClearAlloc ¶
func (s *SessionVars) ClearAlloc(alloc *chunk.Allocator, b bool)
ClearAlloc indicates stop reuse chunk
func (*SessionVars) ClearStmtVars ¶
func (s *SessionVars) ClearStmtVars()
ClearStmtVars clear temporarily system variables.
func (*SessionVars) DecodeSessionStates ¶
func (s *SessionVars) DecodeSessionStates(ctx context.Context, sessionStates *sessionstates.SessionStates) (err error)
DecodeSessionStates restores session states from SessionStates.
func (*SessionVars) EnableEvalTopNEstimationForStrMatch ¶
func (s *SessionVars) EnableEvalTopNEstimationForStrMatch() bool
EnableEvalTopNEstimationForStrMatch means if we need to evaluate expression with TopN to improve estimation. Currently, it's only for string matching functions (like and regexp).
func (*SessionVars) EnableForceInlineCTE ¶
func (s *SessionVars) EnableForceInlineCTE() bool
EnableForceInlineCTE returns the session variable enableForceInlineCTE
func (*SessionVars) EncodeSessionStates ¶
func (s *SessionVars) EncodeSessionStates(ctx context.Context, sessionStates *sessionstates.SessionStates) (err error)
EncodeSessionStates saves session states into SessionStates.
func (*SessionVars) ExchangeChunkStatus ¶
func (s *SessionVars) ExchangeChunkStatus()
ExchangeChunkStatus give the status to preUseChunkAlloc
func (*SessionVars) GetAllowInSubqToJoinAndAgg ¶
func (s *SessionVars) GetAllowInSubqToJoinAndAgg() bool
GetAllowInSubqToJoinAndAgg get AllowInSubqToJoinAndAgg from sql hints and SessionVars.allowInSubqToJoinAndAgg.
func (*SessionVars) GetAllowPreferRangeScan ¶
func (s *SessionVars) GetAllowPreferRangeScan() bool
GetAllowPreferRangeScan get preferRangeScan from SessionVars.preferRangeScan.
func (*SessionVars) GetCPUFactor ¶
func (s *SessionVars) GetCPUFactor() float64
GetCPUFactor returns the session variable cpuFactor
func (*SessionVars) GetCharsetInfo ¶
func (s *SessionVars) GetCharsetInfo() (charset, collation string)
GetCharsetInfo gets charset and collation for current context. What character set should the server translate a statement to after receiving it? For this, the server uses the character_set_connection and collation_connection system variables. It converts statements sent by the client from character_set_client to character_set_connection (except for string literals that have an introducer such as _latin1 or _utf8). collation_connection is important for comparisons of literal strings. For comparisons of strings with column values, collation_connection does not matter because columns have their own collation, which has a higher collation precedence. See https://dev.mysql.com/doc/refman/5.7/en/charset-connection.html
func (*SessionVars) GetConcurrencyFactor ¶
func (s *SessionVars) GetConcurrencyFactor() float64
GetConcurrencyFactor returns the session variable concurrencyFactor
func (*SessionVars) GetCopCPUFactor ¶
func (s *SessionVars) GetCopCPUFactor() float64
GetCopCPUFactor returns the session variable copCPUFactor
func (*SessionVars) GetCurrentShard ¶
func (s *SessionVars) GetCurrentShard(count int) int64
GetCurrentShard returns the shard for the next `count` IDs.
func (*SessionVars) GetDescScanFactor ¶
func (s *SessionVars) GetDescScanFactor(tbl *model.TableInfo) float64
GetDescScanFactor returns the session variable descScanFactor returns 0 when tbl is a temporary table.
func (*SessionVars) GetDiskFactor ¶
func (s *SessionVars) GetDiskFactor() float64
GetDiskFactor returns the session variable diskFactor
func (*SessionVars) GetEnableCascadesPlanner ¶
func (s *SessionVars) GetEnableCascadesPlanner() bool
GetEnableCascadesPlanner get EnableCascadesPlanner from sql hints and SessionVars.EnableCascadesPlanner.
func (*SessionVars) GetEnableIndexMerge ¶
func (s *SessionVars) GetEnableIndexMerge() bool
GetEnableIndexMerge get EnableIndexMerge from SessionVars.enableIndexMerge.
func (*SessionVars) GetEnablePseudoForOutdatedStats ¶
func (s *SessionVars) GetEnablePseudoForOutdatedStats() bool
GetEnablePseudoForOutdatedStats get EnablePseudoForOutdatedStats from SessionVars.EnablePseudoForOutdatedStats.
func (*SessionVars) GetGlobalSystemVar ¶
GetGlobalSystemVar gets a global system variable.
func (*SessionVars) GetIsolationReadEngines ¶
func (s *SessionVars) GetIsolationReadEngines() map[kv.StoreType]struct{}
GetIsolationReadEngines gets isolation read engines.
func (*SessionVars) GetMemoryFactor ¶
func (s *SessionVars) GetMemoryFactor() float64
GetMemoryFactor returns the session variable memoryFactor
func (*SessionVars) GetNegateStrMatchDefaultSelectivity ¶
func (s *SessionVars) GetNegateStrMatchDefaultSelectivity() float64
GetNegateStrMatchDefaultSelectivity means the default selectivity for not like and not regexp. Note:
0 is a special value, which means the default selectivity is 0.9 and TopN assisted estimation is enabled. 0.8 (the default value) is also a special value. For backward compatibility, when the variable is set to 0.8, we keep the default selectivity of like/regexp and not like/regexp all 0.8.
func (*SessionVars) GetNetworkFactor ¶
func (s *SessionVars) GetNetworkFactor(tbl *model.TableInfo) float64
GetNetworkFactor returns the session variable networkFactor returns 0 when tbl is a temporary table.
func (*SessionVars) GetNewChunkWithCapacity ¶
func (s *SessionVars) GetNewChunkWithCapacity(fields []*types.FieldType, capacity int, maxCachesize int, pool chunk.Allocator) *chunk.Chunk
GetNewChunkWithCapacity Attempt to request memory from the chunk pool thread safety
func (*SessionVars) GetNextPreparedStmtID ¶
func (s *SessionVars) GetNextPreparedStmtID() uint32
GetNextPreparedStmtID generates and returns the next session scope prepared statement id.
func (*SessionVars) GetNonPreparedPlanCacheStmt ¶
func (s *SessionVars) GetNonPreparedPlanCacheStmt(sql string) interface{}
GetNonPreparedPlanCacheStmt gets the PlanCacheStmt.
func (*SessionVars) GetParseParams ¶
func (s *SessionVars) GetParseParams() []parser.ParseParam
GetParseParams gets the parse parameters from session variables.
func (*SessionVars) GetPreparedStmtByID ¶
func (s *SessionVars) GetPreparedStmtByID(stmtID uint32) (interface{}, error)
GetPreparedStmtByID returns the prepared statement specified by stmtID.
func (*SessionVars) GetPreparedStmtByName ¶
func (s *SessionVars) GetPreparedStmtByName(stmtName string) (interface{}, error)
GetPreparedStmtByName returns the prepared statement specified by stmtName.
func (*SessionVars) GetPrevStmtDigest ¶
func (s *SessionVars) GetPrevStmtDigest() string
GetPrevStmtDigest returns the digest of the previous statement.
func (*SessionVars) GetReadableTxnMode ¶
func (s *SessionVars) GetReadableTxnMode() string
GetReadableTxnMode returns the session variable TxnMode but rewrites it to "OPTIMISTIC" when it's empty.
func (*SessionVars) GetRelatedTableForMDL ¶
func (s *SessionVars) GetRelatedTableForMDL() *sync.Map
GetRelatedTableForMDL gets the related table for metadata lock.
func (*SessionVars) GetReplicaRead ¶
func (s *SessionVars) GetReplicaRead() kv.ReplicaReadType
GetReplicaRead get ReplicaRead from sql hints and SessionVars.replicaRead.
func (*SessionVars) GetScanFactor ¶
func (s *SessionVars) GetScanFactor(tbl *model.TableInfo) float64
GetScanFactor returns the session variable scanFactor returns 0 when tbl is a temporary table.
func (*SessionVars) GetSeekFactor ¶
func (s *SessionVars) GetSeekFactor(tbl *model.TableInfo) float64
GetSeekFactor returns the session variable seekFactor returns 0 when tbl is a temporary table.
func (*SessionVars) GetSessionOrGlobalSystemVar ¶
GetSessionOrGlobalSystemVar gets a system variable. If it is a session only variable, use the default value defined in code. Returns error if there is no such variable.
func (*SessionVars) GetSessionStatesSystemVar ¶
func (s *SessionVars) GetSessionStatesSystemVar(name string) (string, bool, error)
GetSessionStatesSystemVar gets the session variable value for session states. It's only used for encoding session states when migrating a session. The returned boolean indicates whether to keep this value in the session states.
func (*SessionVars) GetSplitRegionTimeout ¶
func (s *SessionVars) GetSplitRegionTimeout() time.Duration
GetSplitRegionTimeout gets split region timeout.
func (*SessionVars) GetStatusFlag ¶
func (s *SessionVars) GetStatusFlag(flag uint16) bool
GetStatusFlag gets the session server status variable, returns true if it is on.
func (*SessionVars) GetStrMatchDefaultSelectivity ¶
func (s *SessionVars) GetStrMatchDefaultSelectivity() float64
GetStrMatchDefaultSelectivity means the default selectivity for like and regexp. Note: 0 is a special value, which means the default selectivity is 0.1 and TopN assisted estimation is enabled.
func (*SessionVars) GetSystemVar ¶
func (s *SessionVars) GetSystemVar(name string) (string, bool)
GetSystemVar gets the string value of a system variable.
func (*SessionVars) GetTemporaryTable ¶
func (s *SessionVars) GetTemporaryTable(tblInfo *model.TableInfo) tableutil.TempTable
GetTemporaryTable returns a TempTable by tableInfo.
func (*SessionVars) GetUseChunkAlloc ¶
func (s *SessionVars) GetUseChunkAlloc() bool
GetUseChunkAlloc return useChunkAlloc status
func (*SessionVars) GetUserVarType ¶
func (s *SessionVars) GetUserVarType(name string) (*types.FieldType, bool)
GetUserVarType get user defined variables' type
func (*SessionVars) GetUserVarVal ¶
func (s *SessionVars) GetUserVarVal(name string) (types.Datum, bool)
GetUserVarVal get user defined variables' value
func (*SessionVars) GetWriteStmtBufs ¶
func (s *SessionVars) GetWriteStmtBufs() *WriteStmtBufs
GetWriteStmtBufs get pointer of SessionVars.writeStmtBufs.
func (*SessionVars) InTxn ¶
func (s *SessionVars) InTxn() bool
InTxn returns if the session is in transaction.
func (*SessionVars) InitStatementContext ¶
func (s *SessionVars) InitStatementContext() *stmtctx.StatementContext
InitStatementContext initializes a StatementContext, the object is reused to reduce allocation.
func (*SessionVars) IsAutocommit ¶
func (s *SessionVars) IsAutocommit() bool
IsAutocommit returns if the session is set to autocommit.
func (*SessionVars) IsDynamicPartitionPruneEnabled ¶
func (s *SessionVars) IsDynamicPartitionPruneEnabled() bool
IsDynamicPartitionPruneEnabled indicates whether dynamic partition prune enabled Note that: IsDynamicPartitionPruneEnabled only indicates whether dynamic partition prune mode is enabled according to session variable, it isn't guaranteed to be used during query due to other conditions checking.
func (*SessionVars) IsIsolation ¶
func (s *SessionVars) IsIsolation(isolation string) bool
IsIsolation if true it means the transaction is at that isolation level.
func (*SessionVars) IsMPPAllowed ¶
func (s *SessionVars) IsMPPAllowed() bool
IsMPPAllowed returns whether mpp execution is allowed.
func (*SessionVars) IsMPPEnforced ¶
func (s *SessionVars) IsMPPEnforced() bool
IsMPPEnforced returns whether mpp execution is enforced.
func (*SessionVars) IsPessimisticReadConsistency ¶
func (s *SessionVars) IsPessimisticReadConsistency() bool
IsPessimisticReadConsistency if true it means the statement is in an read consistency pessimistic transaction.
func (*SessionVars) IsPlanReplayerCaptureEnabled ¶
func (s *SessionVars) IsPlanReplayerCaptureEnabled() bool
IsPlanReplayerCaptureEnabled indicates whether capture or continues capture enabled
func (*SessionVars) IsReplicaReadClosestAdaptive ¶
func (s *SessionVars) IsReplicaReadClosestAdaptive() bool
IsReplicaReadClosestAdaptive returns whether adaptive closest replica can be enabled.
func (*SessionVars) IsolationLevelForNewTxn ¶
func (s *SessionVars) IsolationLevelForNewTxn() (isolation string)
IsolationLevelForNewTxn returns the isolation level if we want to enter a new transaction
func (*SessionVars) LazyCheckKeyNotExists ¶
func (s *SessionVars) LazyCheckKeyNotExists() bool
LazyCheckKeyNotExists returns if we can lazy check key not exists.
func (*SessionVars) Location ¶
func (s *SessionVars) Location() *time.Location
Location returns the value of time_zone session variable. If it is nil, then return time.Local.
func (*SessionVars) RaiseWarningWhenMPPEnforced ¶
func (s *SessionVars) RaiseWarningWhenMPPEnforced(warning string)
RaiseWarningWhenMPPEnforced will raise a warning when mpp mode is enforced and executing explain statement. TODO: Confirm whether this function will be inlined and omit the overhead of string construction when calling with false condition.
func (*SessionVars) RemovePreparedStmt ¶
func (s *SessionVars) RemovePreparedStmt(stmtID uint32)
RemovePreparedStmt removes preparedStmt from current session and decrease count in global.
func (*SessionVars) SetAlloc ¶
func (s *SessionVars) SetAlloc(alloc chunk.Allocator)
SetAlloc Attempt to set the buffer pool address
func (*SessionVars) SetAllowInSubqToJoinAndAgg ¶
func (s *SessionVars) SetAllowInSubqToJoinAndAgg(val bool)
SetAllowInSubqToJoinAndAgg set SessionVars.allowInSubqToJoinAndAgg.
func (*SessionVars) SetAllowPreferRangeScan ¶
func (s *SessionVars) SetAllowPreferRangeScan(val bool)
SetAllowPreferRangeScan set SessionVars.preferRangeScan.
func (*SessionVars) SetEnableCascadesPlanner ¶
func (s *SessionVars) SetEnableCascadesPlanner(val bool)
SetEnableCascadesPlanner set SessionVars.EnableCascadesPlanner.
func (*SessionVars) SetEnableIndexMerge ¶
func (s *SessionVars) SetEnableIndexMerge(val bool)
SetEnableIndexMerge set SessionVars.enableIndexMerge.
func (*SessionVars) SetEnablePseudoForOutdatedStats ¶
func (s *SessionVars) SetEnablePseudoForOutdatedStats(val bool)
SetEnablePseudoForOutdatedStats set SessionVars.EnablePseudoForOutdatedStats.
func (*SessionVars) SetInTxn ¶
func (s *SessionVars) SetInTxn(val bool)
SetInTxn sets whether the session is in transaction. It also updates the IsExplicit flag in TxnCtx if val is true.
func (*SessionVars) SetLastInsertID ¶
func (s *SessionVars) SetLastInsertID(insertID uint64)
SetLastInsertID saves the last insert id to the session context. TODO: we may store the result for last_insert_id sys var later.
func (*SessionVars) SetNextPreparedStmtID ¶
func (s *SessionVars) SetNextPreparedStmtID(preparedStmtID uint32)
SetNextPreparedStmtID sets the next prepared statement id. It's only used in restoring session states.
func (*SessionVars) SetPrevStmtDigest ¶
func (s *SessionVars) SetPrevStmtDigest(prevStmtDigest string)
SetPrevStmtDigest sets the digest of the previous statement.
func (*SessionVars) SetReplicaRead ¶
func (s *SessionVars) SetReplicaRead(val kv.ReplicaReadType)
SetReplicaRead set SessionVars.replicaRead.
func (*SessionVars) SetStatusFlag ¶
func (s *SessionVars) SetStatusFlag(flag uint16, on bool)
SetStatusFlag sets the session server status variable. If on is true sets the flag in session status, otherwise removes the flag.
func (*SessionVars) SetStmtVar ¶
func (s *SessionVars) SetStmtVar(name string, value string) error
SetStmtVar sets system variable and updates SessionVars states.
func (*SessionVars) SetStringUserVar ¶
func (s *SessionVars) SetStringUserVar(name string, strVal string, collation string)
SetStringUserVar set the value and collation for user defined variable.
func (*SessionVars) SetSystemVar ¶
func (s *SessionVars) SetSystemVar(name string, val string) error
SetSystemVar sets the value of a system variable for session scope. Values are automatically normalized (i.e. oN / on / 1 => ON) and the validation function is run. To set with less validation, see SetSystemVarWithRelaxedValidation.
func (*SessionVars) SetSystemVarWithRelaxedValidation ¶
func (s *SessionVars) SetSystemVarWithRelaxedValidation(name string, val string) error
SetSystemVarWithRelaxedValidation sets the value of a system variable for session scope. Validation functions are called, but scope validation is skipped. Errors are not expected to be returned because this could cause upgrade issues.
func (*SessionVars) SetSystemVarWithoutValidation ¶
func (s *SessionVars) SetSystemVarWithoutValidation(name string, val string) error
SetSystemVarWithoutValidation sets the value of a system variable for session scope. Deprecated: Values are NOT normalized or Validated.
func (*SessionVars) SetTxnIsolationLevelOneShotStateForNextTxn ¶
func (s *SessionVars) SetTxnIsolationLevelOneShotStateForNextTxn()
SetTxnIsolationLevelOneShotStateForNextTxn sets the txnIsolationLevelOneShot.state for next transaction.
func (*SessionVars) SetUserVarType ¶
func (s *SessionVars) SetUserVarType(name string, ft *types.FieldType)
SetUserVarType set user defined variables' type
func (*SessionVars) SetUserVarVal ¶
func (s *SessionVars) SetUserVarVal(name string, dt types.Datum)
SetUserVarVal set user defined variables' value
func (*SessionVars) SlowLogFormat ¶
func (s *SessionVars) SlowLogFormat(logItems *SlowQueryLogItems) string
SlowLogFormat uses for formatting slow log. The slow log output is like below: # Time: 2019-04-28T15:24:04.309074+08:00 # Txn_start_ts: 406315658548871171 # User@Host: root[root] @ localhost [127.0.0.1] # Conn_ID: 6 # Query_time: 4.895492 # Process_time: 0.161 Request_count: 1 Total_keys: 100001 Processed_keys: 100000 # DB: test # Index_names: [t1.idx1,t2.idx2] # Is_internal: false # Digest: 42a1c8aae6f133e934d4bf0147491709a8812ea05ff8819ec522780fe657b772 # Stats: t1:1,t2:2 # Num_cop_tasks: 10 # Cop_process: Avg_time: 1s P90_time: 2s Max_time: 3s Max_addr: 10.6.131.78 # Cop_wait: Avg_time: 10ms P90_time: 20ms Max_time: 30ms Max_Addr: 10.6.131.79 # Memory_max: 4096 # Disk_max: 65535 # Succ: true # Prev_stmt: begin; select * from t_slim;
func (*SessionVars) UnsetUserVar ¶
func (s *SessionVars) UnsetUserVar(varName string)
UnsetUserVar unset an user defined variable by name.
func (*SessionVars) WithdrawAllPreparedStmt ¶
func (s *SessionVars) WithdrawAllPreparedStmt()
WithdrawAllPreparedStmt remove all preparedStmt in current session and decrease count in global.
type SlowQueryLogItems ¶
type SlowQueryLogItems struct { TxnTS uint64 SQL string Digest string TimeTotal time.Duration TimeParse time.Duration TimeCompile time.Duration TimeOptimize time.Duration TimeWaitTS time.Duration IndexNames string StatsInfos map[string]uint64 CopTasks *stmtctx.CopTasksDetails ExecDetail execdetails.ExecDetails MemMax int64 DiskMax int64 Succ bool Prepared bool PlanFromCache bool PlanFromBinding bool HasMoreResults bool PrevStmt string Plan string PlanDigest string BinaryPlan string RewriteInfo RewritePhaseInfo KVTotal time.Duration PDTotal time.Duration BackoffTotal time.Duration WriteSQLRespTotal time.Duration ExecRetryCount uint ExecRetryTime time.Duration ResultRows int64 IsExplicitTxn bool IsWriteCacheTable bool // table -> name -> status StatsLoadStatus map[string]map[string]string IsSyncStatsFailed bool Warnings []JSONSQLWarnForSlowLog }
SlowQueryLogItems is a collection of items that should be included in the slow query log.
type Statistics ¶
type Statistics interface { // GetScope gets the status variables scope. GetScope(status string) ScopeFlag // Stats returns the statistics status variables. Stats(*SessionVars) (map[string]interface{}, error) }
Statistics is the interface of statistics.
type StatusVal ¶
type StatusVal struct { Scope ScopeFlag Value interface{} }
StatusVal is the value of the corresponding status variable.
type SysVar ¶
type SysVar struct { // Scope is for whether can be changed or not Scope ScopeFlag // Name is the variable name. Name string // Value is the variable value. Value string // Type is the MySQL type (optional) Type TypeFlag // MinValue will automatically be validated when specified (optional) MinValue int64 // MaxValue will automatically be validated when specified (optional) MaxValue uint64 // AutoConvertNegativeBool applies to boolean types (optional) AutoConvertNegativeBool bool // ReadOnly applies to all types ReadOnly bool // PossibleValues applies to ENUM type PossibleValues []string // AllowEmpty is a special TiDB behavior which means "read value from config" (do not use) AllowEmpty bool // AllowEmptyAll is a special behavior that only applies to TiDBCapturePlanBaseline, TiDBTxnMode (do not use) AllowEmptyAll bool // AllowAutoValue means that the special value "-1" is permitted, even when outside of range. AllowAutoValue bool // Validation is a callback after the type validation has been performed, but before the Set function Validation func(*SessionVars, string, string, ScopeFlag) (string, error) // SetSession is called after validation but before updating systems[]. It also doubles as an Init function // and will be called on all variables in builtinGlobalVariable, regardless of their scope. SetSession func(*SessionVars, string) error // SetGlobal is called after validation SetGlobal func(context.Context, *SessionVars, string) error // IsHintUpdatable indicate whether it's updatable via SET_VAR() hint (optional) IsHintUpdatable bool // Deprecated: Hidden previously meant that the variable still responds to SET but doesn't show up in SHOW VARIABLES // However, this feature is no longer used. All variables are visble. Hidden bool // Aliases is a list of sysvars that should also be updated when this sysvar is updated. // Updating aliases calls the SET function of the aliases, but does not update their aliases (preventing SET recursion) Aliases []string // GetSession is a getter function for session scope. // It can be used by instance-scoped variables to overwrite the previously expected value. GetSession func(*SessionVars) (string, error) // GetGlobal is a getter function for global scope. GetGlobal func(context.Context, *SessionVars) (string, error) // GetStateValue gets the value for session states, which is used for migrating sessions. // We need a function to override GetSession sometimes, because GetSession may not return the real value. GetStateValue func(*SessionVars) (string, bool, error) // IsNoop defines if the sysvar is a noop included for MySQL compatibility IsNoop bool // GlobalConfigName is the global config name of this global variable. // If the global variable has the global config name, // it should store the global config into PD(etcd) too when set global variable. GlobalConfigName string // RequireDynamicPrivileges is a function to return a dynamic privilege list to check the set sysvar privilege RequireDynamicPrivileges func(isGlobal bool, sem bool) []string // contains filtered or unexported fields }
SysVar is for system variable. All the fields of SysVar should be READ ONLY after created.
func (*SysVar) GetGlobalFromHook ¶
GetGlobalFromHook calls the GetSession func if it exists.
func (*SysVar) GetNativeValType ¶
GetNativeValType attempts to convert the val to the approx MySQL non-string type
func (*SysVar) GetSessionFromHook ¶
func (sv *SysVar) GetSessionFromHook(s *SessionVars) (string, error)
GetSessionFromHook calls the GetSession func if it exists.
func (*SysVar) HasGlobalScope ¶
HasGlobalScope returns true if the scope for the sysVar includes global.
func (*SysVar) HasInstanceScope ¶
HasInstanceScope returns true if the scope for the sysVar includes instance
func (*SysVar) HasNoneScope ¶
HasNoneScope returns true if the scope for the sysVar is None.
func (*SysVar) HasSessionScope ¶
HasSessionScope returns true if the scope for the sysVar includes session.
func (*SysVar) SetGlobalFromHook ¶
func (sv *SysVar) SetGlobalFromHook(ctx context.Context, s *SessionVars, val string, skipAliases bool) error
SetGlobalFromHook calls the SetGlobal func if it exists.
func (*SysVar) SetSessionFromHook ¶
func (sv *SysVar) SetSessionFromHook(s *SessionVars, val string) error
SetSessionFromHook calls the SetSession func if it exists.
func (*SysVar) SkipInit ¶
SkipInit returns true if when a new session is created we should "skip" copying an initial value to it (and call the SetSession func if it exists)
func (*SysVar) SkipSysvarCache ¶
SkipSysvarCache returns true if the sysvar should not re-execute on peers This doesn't make sense for the GC variables because they are based in tikv tables. We'd effectively be reading and writing to the same table, which could be in an unsafe manner. In future these variables might be converted to not use a different table internally, but to do that we need to first fix upgrade/downgrade so we know that older servers won't be in the cluster which update only these values.
func (*SysVar) ValidateFromType ¶
func (sv *SysVar) ValidateFromType(vars *SessionVars, value string, scope ScopeFlag) (string, error)
ValidateFromType provides automatic validation based on the SysVar's type
func (*SysVar) ValidateWithRelaxedValidation ¶
func (sv *SysVar) ValidateWithRelaxedValidation(vars *SessionVars, value string, scope ScopeFlag) string
ValidateWithRelaxedValidation normalizes values but can not return errors. Normalization+validation needs to be applied when reading values because older versions of TiDB may be less sophisticated in normalizing values. But errors should be caught and handled, because otherwise there will be upgrade issues.
type TableDelta ¶
type TableDelta struct { Delta int64 Count int64 ColSize map[int64]int64 InitTime time.Time // InitTime is the time that this delta is generated. TableID int64 }
TableDelta stands for the changed count for one table or partition.
func (TableDelta) Clone ¶
func (td TableDelta) Clone() TableDelta
Clone returns a cloned TableDelta.
type TableSnapshot ¶
TableSnapshot represents a data snapshot of the table contained in `information_schema`.
type TemporaryTableData ¶
type TemporaryTableData interface { kv.Retriever // Staging create a new staging buffer inside the MemBuffer. // Subsequent writes will be temporarily stored in this new staging buffer. // When you think all modifications looks good, you can call `Release` to public all of them to the upper level buffer. Staging() kv.StagingHandle // Release publish all modifications in the latest staging buffer to upper level. Release(kv.StagingHandle) // Cleanup cleanups the resources referenced by the StagingHandle. // If the changes are not published by `Release`, they will be discarded. Cleanup(kv.StagingHandle) // GetTableSize get the size of a table GetTableSize(tblID int64) int64 // DeleteTableKey removes the entry for key k from table DeleteTableKey(tblID int64, k kv.Key) error // SetTableKey sets the entry for k from table SetTableKey(tblID int64, k kv.Key, val []byte) error }
TemporaryTableData is a interface to maintain temporary data in session
func NewTemporaryTableData ¶
func NewTemporaryTableData(memBuffer kv.MemBuffer) TemporaryTableData
NewTemporaryTableData creates a new TemporaryTableData
type TransactionContext ¶
type TransactionContext struct { TxnCtxNoNeedToRestore TxnCtxNeedToRestore }
TransactionContext is used to store variables that has transaction scope.
func (*TransactionContext) AddSavepoint ¶
func (tc *TransactionContext) AddSavepoint(name string, memdbCheckpoint *tikv.MemDBCheckpoint)
AddSavepoint adds a new savepoint.
func (*TransactionContext) AddUnchangedRowKey ¶
func (tc *TransactionContext) AddUnchangedRowKey(key []byte)
AddUnchangedRowKey adds an unchanged row key in update statement for pessimistic lock.
func (*TransactionContext) Cleanup ¶
func (tc *TransactionContext) Cleanup()
Cleanup clears up transaction info that no longer use.
func (*TransactionContext) ClearDelta ¶
func (tc *TransactionContext) ClearDelta()
ClearDelta clears the delta map.
func (*TransactionContext) CollectUnchangedRowKeys ¶
func (tc *TransactionContext) CollectUnchangedRowKeys(buf []kv.Key) []kv.Key
CollectUnchangedRowKeys collects unchanged row keys for pessimistic lock.
func (*TransactionContext) DeleteSavepoint ¶
func (tc *TransactionContext) DeleteSavepoint(name string) bool
DeleteSavepoint deletes the savepoint, return false indicate the savepoint name doesn't exists.
func (*TransactionContext) GetCurrentSavepoint ¶
func (tc *TransactionContext) GetCurrentSavepoint() TxnCtxNeedToRestore
GetCurrentSavepoint gets TransactionContext's savepoint.
func (*TransactionContext) GetForUpdateTS ¶
func (tc *TransactionContext) GetForUpdateTS() uint64
GetForUpdateTS returns the ts for update.
func (*TransactionContext) GetKeyInPessimisticLockCache ¶
func (tc *TransactionContext) GetKeyInPessimisticLockCache(key kv.Key) (val []byte, ok bool)
GetKeyInPessimisticLockCache gets a key in pessimistic lock cache.
func (*TransactionContext) ReleaseSavepoint ¶
func (tc *TransactionContext) ReleaseSavepoint(name string) bool
ReleaseSavepoint deletes the named savepoint and the later savepoints, return false indicate the named savepoint doesn't exists.
func (*TransactionContext) RestoreBySavepoint ¶
func (tc *TransactionContext) RestoreBySavepoint(savepoint TxnCtxNeedToRestore)
RestoreBySavepoint restores TransactionContext to the specify savepoint.
func (*TransactionContext) RollbackToSavepoint ¶
func (tc *TransactionContext) RollbackToSavepoint(name string) *SavepointRecord
RollbackToSavepoint rollbacks to the specified savepoint by name.
func (*TransactionContext) SetForUpdateTS ¶
func (tc *TransactionContext) SetForUpdateTS(forUpdateTS uint64)
SetForUpdateTS sets the ts for update.
func (*TransactionContext) SetPessimisticLockCache ¶
func (tc *TransactionContext) SetPessimisticLockCache(key kv.Key, val []byte)
SetPessimisticLockCache sets a key value pair into pessimistic lock cache.
func (*TransactionContext) UpdateDeltaForTable ¶
func (tc *TransactionContext) UpdateDeltaForTable(physicalTableID int64, delta int64, count int64, colSize map[int64]int64)
UpdateDeltaForTable updates the delta info for some table.
type TxnCtxNeedToRestore ¶
type TxnCtxNeedToRestore struct { // TableDeltaMap is used in the schema validator for DDL changes in one table not to block others. // It's also used in the statistics updating. // Note: for the partitioned table, it stores all the partition IDs. TableDeltaMap map[int64]TableDelta // CachedTables is not nil if the transaction write on cached table. CachedTables map[int64]interface{} // contains filtered or unexported fields }
TxnCtxNeedToRestore stores transaction variables which need to be restored when rolling back to a savepoint.
type TxnCtxNoNeedToRestore ¶
type TxnCtxNoNeedToRestore struct { Binlog interface{} InfoSchema interface{} History interface{} StartTS uint64 // ShardStep indicates the max size of continuous rowid shard in one transaction. ShardStep int PessimisticCacheHit int // CreateTime For metrics. CreateTime time.Time StatementCount int CouldRetry bool IsPessimistic bool // IsStaleness indicates whether the txn is read only staleness txn. IsStaleness bool // IsExplicit indicates whether the txn is an interactive txn, which is typically started with a BEGIN // or START TRANSACTION statement, or by setting autocommit to 0. IsExplicit bool Isolation string LockExpire uint32 ForUpdate uint32 // TxnScope indicates the value of txn_scope TxnScope string // Savepoints contains all definitions of the savepoint of a transaction at runtime, the order of the SavepointRecord is the same with the SAVEPOINT statements. // It is used for a lookup when running `ROLLBACK TO` statement. Savepoints []SavepointRecord // TemporaryTables is used to store transaction-specific information for global temporary tables. // It can also be stored in sessionCtx with local temporary tables, but it's easier to clean this data after transaction ends. TemporaryTables map[int64]tableutil.TempTable // EnableMDL indicates whether to enable the MDL lock for the transaction. EnableMDL bool // contains filtered or unexported fields }
TxnCtxNoNeedToRestore stores transaction variables which do not need to restored when rolling back to a savepoint.
type TxnReadTS ¶
type TxnReadTS struct {
// contains filtered or unexported fields
}
TxnReadTS indicates the value and used situation for tx_read_ts
func (*TxnReadTS) PeakTxnReadTS ¶
PeakTxnReadTS returns readTS
func (*TxnReadTS) SetTxnReadTS ¶
SetTxnReadTS update readTS, and refresh used
func (*TxnReadTS) UseTxnReadTS ¶
UseTxnReadTS returns readTS, and mark used as true
type TypeFlag ¶
type TypeFlag byte
TypeFlag is the SysVar type, which doesn't exactly match MySQL types.
type WriteStmtBufs ¶
type WriteStmtBufs struct { // RowValBuf is used by tablecodec.EncodeRow, to reduce runtime.growslice. RowValBuf []byte // AddRowValues use to store temp insert rows value, to reduce memory allocations when importing data. AddRowValues []types.Datum // IndexValsBuf is used by index.FetchValues IndexValsBuf []types.Datum // IndexKeyBuf is used by index.GenIndexKey IndexKeyBuf []byte }
WriteStmtBufs can be used by insert/replace/delete/update statement. TODO: use a common memory pool to replace this.