Documentation ¶
Index ¶
- Constants
- func AllocateTaskID() uint64
- type CopTasksDetails
- type ReferenceCount
- type SQLWarn
- type StatementContext
- func (sc *StatementContext) AddAffectedRows(rows uint64)
- func (sc *StatementContext) AddCopiedRows(rows uint64)
- func (sc *StatementContext) AddDeletedRows(rows uint64)
- func (sc *StatementContext) AddFoundRows(rows uint64)
- func (sc *StatementContext) AddRecordRows(rows uint64)
- func (sc *StatementContext) AddTouchedRows(rows uint64)
- func (sc *StatementContext) AddUpdatedRows(rows uint64)
- func (sc *StatementContext) AffectedRows() uint64
- func (sc *StatementContext) AppendError(warn error)
- func (sc *StatementContext) AppendExtraError(warn error)
- func (sc *StatementContext) AppendExtraNote(warn error)
- func (sc *StatementContext) AppendExtraWarning(warn error)
- func (sc *StatementContext) AppendNote(warn error)
- func (sc *StatementContext) AppendWarning(warn error)
- func (sc *StatementContext) AppendWarnings(warns []SQLWarn)
- func (sc *StatementContext) ClearUseChunkAlloc()
- func (sc *StatementContext) CopTasksDetails() *CopTasksDetails
- func (sc *StatementContext) CopiedRows() uint64
- func (sc *StatementContext) DeletedRows() uint64
- func (sc *StatementContext) FoundRows() uint64
- func (sc *StatementContext) GetBinaryPlan() string
- func (sc *StatementContext) GetEncodedPlan() string
- func (sc *StatementContext) GetExecDetails() execdetails.ExecDetails
- func (sc *StatementContext) GetExtraWarnings() []SQLWarn
- func (sc *StatementContext) GetFlatPlan() interface{}
- func (sc *StatementContext) GetLockWaitStartTime() time.Time
- func (sc *StatementContext) GetMessage() string
- func (sc *StatementContext) GetOrEvaluateStmtCache(key StmtCacheKey, valueEvaluator func() (interface{}, error)) (interface{}, error)
- func (sc *StatementContext) GetOrStoreStmtCache(key StmtCacheKey, value interface{}) interface{}
- func (sc *StatementContext) GetPlan() interface{}
- func (sc *StatementContext) GetPlanDigest() (normalized string, planDigest *parser.Digest)
- func (sc *StatementContext) GetPlanHint() (string, bool)
- func (sc *StatementContext) GetResourceGroupTagger() tikvrpc.ResourceGroupTagger
- func (sc *StatementContext) GetUseChunkAllocStatus() bool
- func (sc *StatementContext) GetWarnings() []SQLWarn
- func (sc *StatementContext) HandleOverflow(err error, warnErr error) error
- func (sc *StatementContext) HandleTruncate(err error) error
- func (sc *StatementContext) InitDiskTracker(label int, bytesLimit int64)
- func (sc *StatementContext) InitMemTracker(label int, bytesLimit int64)
- func (sc *StatementContext) InitSQLDigest(normalized string, digest *parser.Digest)
- func (sc *StatementContext) MergeExecDetails(details *execdetails.ExecDetails, commitDetails *util.CommitDetails)
- func (sc *StatementContext) MergeLockKeysExecDetails(lockKeys *util.LockKeysDetails)
- func (sc *StatementContext) MergeScanDetail(scanDetail *util.ScanDetail)
- func (sc *StatementContext) MergeTimeDetail(timeDetail util.TimeDetail)
- func (sc *StatementContext) NumErrorWarnings() (ec uint16, wc int)
- func (sc *StatementContext) PushDownFlags() uint64
- func (sc *StatementContext) RecordRangeFallback(rangeMaxSize int64)
- func (sc *StatementContext) RecordRows() uint64
- func (sc *StatementContext) ResetForRetry()
- func (sc *StatementContext) ResetInStmtCache(key StmtCacheKey)
- func (sc *StatementContext) ResetSQLDigest(s string)
- func (sc *StatementContext) ResetStmtCache()
- func (sc *StatementContext) SQLDigest() (normalized string, sqlDigest *parser.Digest)
- func (sc *StatementContext) SetAffectedRows(rows uint64)
- func (sc *StatementContext) SetBinaryPlan(binaryPlan string)
- func (sc *StatementContext) SetEncodedPlan(encodedPlan string)
- func (sc *StatementContext) SetExtraWarnings(warns []SQLWarn)
- func (sc *StatementContext) SetFlagsFromPBFlag(flags uint64)
- func (sc *StatementContext) SetFlatPlan(flat interface{})
- func (sc *StatementContext) SetMessage(msg string)
- func (sc *StatementContext) SetPlan(plan interface{})
- func (sc *StatementContext) SetPlanDigest(normalized string, planDigest *parser.Digest)
- func (sc *StatementContext) SetPlanHint(hint string)
- func (sc *StatementContext) SetSkipPlanCache(reason error)
- func (sc *StatementContext) SetUseChunkAlloc()
- func (sc *StatementContext) SetWarnings(warns []SQLWarn)
- func (sc *StatementContext) ShouldClipToZero() bool
- func (sc *StatementContext) ShouldIgnoreOverflowError() bool
- func (sc *StatementContext) TouchedRows() uint64
- func (sc *StatementContext) TruncateWarnings(start int) []SQLWarn
- func (sc *StatementContext) UpdatedRows() uint64
- func (sc *StatementContext) UseDynamicPartitionPrune() bool
- func (sc *StatementContext) WarningCount() uint16
- type StatsLoadResult
- type StmtCacheKey
- type StmtHints
- type TableEntry
Constants ¶
const ( // WarnLevelError represents level "Error" for 'SHOW WARNINGS' syntax. WarnLevelError = "Error" // WarnLevelWarning represents level "Warning" for 'SHOW WARNINGS' syntax. WarnLevelWarning = "Warning" // WarnLevelNote represents level "Note" for 'SHOW WARNINGS' syntax. WarnLevelNote = "Note" )
const ( // ReferenceCountIsFrozen indicates the current StmtCtx is resetting, it'll refuse all the access from other sessions. ReferenceCountIsFrozen int32 = -1 // ReferenceCountNoReference indicates the current StmtCtx is not accessed by other sessions. ReferenceCountNoReference int32 = 0 )
Variables ¶
This section is empty.
Functions ¶
func AllocateTaskID ¶
func AllocateTaskID() uint64
AllocateTaskID allocates a new unique ID for a statement execution
Types ¶
type CopTasksDetails ¶
type CopTasksDetails struct { NumCopTasks int AvgProcessTime time.Duration P90ProcessTime time.Duration MaxProcessAddress string MaxProcessTime time.Duration AvgWaitTime time.Duration P90WaitTime time.Duration MaxWaitAddress string MaxWaitTime time.Duration MaxBackoffTime map[string]time.Duration MaxBackoffAddress map[string]string AvgBackoffTime map[string]time.Duration P90BackoffTime map[string]time.Duration TotBackoffTime map[string]time.Duration TotBackoffTimes map[string]int }
CopTasksDetails collects some useful information of cop-tasks during execution.
func (*CopTasksDetails) ToZapFields ¶
func (d *CopTasksDetails) ToZapFields() (fields []zap.Field)
ToZapFields wraps the CopTasksDetails as zap.Fileds.
type ReferenceCount ¶
type ReferenceCount int32
ReferenceCount indicates the reference count of StmtCtx.
func (*ReferenceCount) Decrease ¶
func (rf *ReferenceCount) Decrease()
Decrease decreases the reference count.
func (*ReferenceCount) TryFreeze ¶
func (rf *ReferenceCount) TryFreeze() bool
TryFreeze tries to freeze the StmtCtx to frozen before resetting the old StmtCtx.
func (*ReferenceCount) TryIncrease ¶
func (rf *ReferenceCount) TryIncrease() bool
TryIncrease tries to increase the reference count. There is a small chance that TryIncrease returns true while TryFreeze and UnFreeze are invoked successfully during the execution of TryIncrease.
func (*ReferenceCount) UnFreeze ¶
func (rf *ReferenceCount) UnFreeze()
UnFreeze unfreeze the frozen StmtCtx thus the other session can access this StmtCtx.
type SQLWarn ¶
SQLWarn relates a sql warning and it's level.
func (*SQLWarn) MarshalJSON ¶
MarshalJSON implements the Marshaler.MarshalJSON interface.
func (*SQLWarn) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler.UnmarshalJSON interface.
type StatementContext ¶
type StatementContext struct { // Set the following variables before execution StmtHints // IsDDLJobInQueue is used to mark whether the DDL job is put into the queue. // If IsDDLJobInQueue is true, it means the DDL job is in the queue of storage, and it can be handled by the DDL worker. IsDDLJobInQueue bool DDLJobID int64 InInsertStmt bool InUpdateStmt bool InDeleteStmt bool InSelectStmt bool InLoadDataStmt bool InExplainStmt bool InCreateOrAlterStmt bool InSetSessionStatesStmt bool InPreparedPlanBuilding bool IgnoreTruncate bool IgnoreZeroInDate bool NoZeroDate bool DupKeyAsWarning bool BadNullAsWarning bool DividedByZeroAsWarning bool TruncateAsWarning bool OverflowAsWarning bool ErrAutoincReadFailedAsWarning bool InShowWarning bool UseCache bool BatchCheck bool InNullRejectCheck bool AllowInvalidDate bool IgnoreNoPartition bool IgnoreExplainIDSuffix bool SkipUTF8Check bool SkipASCIICheck bool SkipUTF8MB4Check bool MultiSchemaInfo *model.MultiSchemaInfo // If the select statement was like 'select * from t as of timestamp ...' or in a stale read transaction // or is affected by the tidb_read_staleness session variable, then the statement will be makred as isStaleness // in stmtCtx IsStaleness bool InRestrictedSQL bool ViewDepth int32 // PrevAffectedRows is the affected-rows value(DDL is 0, DML is the number of affected rows). PrevAffectedRows int64 // PrevLastInsertID is the last insert ID of previous statement. PrevLastInsertID uint64 // LastInsertID is the auto-generated ID in the current statement. LastInsertID uint64 // InsertID is the given insert ID of an auto_increment column. InsertID uint64 BaseRowID int64 MaxRowID int64 // Copied from SessionVars.TimeZone. TimeZone *time.Location Priority mysql.PriorityEnum NotFillCache bool MemTracker *memory.Tracker DiskTracker *disk.Tracker IsTiFlash atomic2.Bool RuntimeStatsColl *execdetails.RuntimeStatsColl TableIDs []int64 IndexNames []string StmtType string OriginalSQL string // BindSQL used to construct the key for plan cache. It records the binding used by the stmt. // If the binding is not used by the stmt, the value is empty BindSQL string Tables []TableEntry PointExec bool // for point update cached execution, Constant expression need to set "paramMarker" PessimisticLockWaited int32 LockKeysDuration int64 LockKeysCount int32 LockTableIDs map[int64]struct{} // table IDs need to be locked, empty for lock all tables TblInfo2UnionScan map[*model.TableInfo]bool TaskID uint64 // unique ID for an execution of a statement TaskMapBakTS uint64 // counter for // Map to store all CTE storages of current SQL. // Will clean up at the end of the execution. CTEStorageMap interface{} // If the statement read from table cache, this flag is set. ReadFromTableCache bool // InVerboseExplain indicates the statement is "explain format='verbose' ...". InVerboseExplain bool // EnableOptimizeTrace indicates whether enable optimizer trace by 'trace plan statement' EnableOptimizeTrace bool // OptimizeTracer indicates the tracer for optimize OptimizeTracer *tracing.OptimizeTracer // EnableOptimizerCETrace indicate if cardinality estimation internal process needs to be traced. // CE Trace is currently a submodule of the optimizer trace and is controlled by a separated option. EnableOptimizerCETrace bool OptimizerCETrace []*tracing.CETraceRecord // WaitLockLeaseTime is the duration of cached table read lease expiration time. WaitLockLeaseTime time.Duration // KvExecCounter is created from SessionVars.StmtStats to count the number of SQL // executions of the kv layer during the current execution of the statement. // Its life cycle is limited to this execution, and a new KvExecCounter is // always created during each statement execution. KvExecCounter *stmtstats.KvExecCounter // WeakConsistency is true when read consistency is weak and in a read statement and not in a transaction. WeakConsistency bool StatsLoad struct { // Timeout to wait for sync-load Timeout time.Duration // NeededItems stores the columns/indices whose stats are needed for planner. NeededItems []model.TableItemID // ResultCh to receive stats loading results ResultCh chan StatsLoadResult // LoadStartTime is to record the load start time to calculate latency LoadStartTime time.Time } // SysdateIsNow indicates whether sysdate() is an alias of now() in this statement SysdateIsNow bool // RCCheckTS indicates the current read-consistency read select statement will use `RCCheckTS` path. RCCheckTS bool // IsSQLRegistered uses to indicate whether the SQL has been registered for TopSQL. IsSQLRegistered atomic2.Bool // IsSQLAndPlanRegistered uses to indicate whether the SQL and plan has been registered for TopSQL. IsSQLAndPlanRegistered atomic2.Bool // IsReadOnly uses to indicate whether the SQL is read-only. IsReadOnly bool // StatsLoadStatus records StatsLoadedStatus for the index/column which is used in query StatsLoadStatus map[model.TableItemID]string // IsSyncStatsFailed indicates whether any failure happened during sync stats IsSyncStatsFailed bool // UseDynamicPruneMode indicates whether use UseDynamicPruneMode in query stmt UseDynamicPruneMode bool // ColRefFromPlan mark the column ref used by assignment in update statement. ColRefFromUpdatePlan []int64 // RangeFallback indicates that building complete ranges exceeds the memory limit so it falls back to less accurate ranges such as full range. RangeFallback bool // IsExplainAnalyzeDML is true if the statement is "explain analyze DML executors", before responding the explain // results to the client, the transaction should be committed first. See issue #37373 for more details. IsExplainAnalyzeDML bool // InHandleForeignKeyTrigger indicates currently are handling foreign key trigger. InHandleForeignKeyTrigger bool // ForeignKeyTriggerCtx is the contain information for foreign key cascade execution. ForeignKeyTriggerCtx struct { // The SavepointName is use to do rollback when handle foreign key cascade failed. SavepointName string HasFKCascades bool } // MPPQueryInfo stores some id and timestamp of current MPP query statement. MPPQueryInfo struct { QueryID atomic2.Uint64 QueryTS atomic2.Uint64 AllocatedMPPTaskID atomic2.Int64 } // TableStats stores the visited runtime table stats by table id during query TableStats map[int64]interface{} // contains filtered or unexported fields }
StatementContext contains variables for a statement. It should be reset before executing a statement.
func (*StatementContext) AddAffectedRows ¶
func (sc *StatementContext) AddAffectedRows(rows uint64)
AddAffectedRows adds affected rows.
func (*StatementContext) AddCopiedRows ¶
func (sc *StatementContext) AddCopiedRows(rows uint64)
AddCopiedRows adds copied rows.
func (*StatementContext) AddDeletedRows ¶
func (sc *StatementContext) AddDeletedRows(rows uint64)
AddDeletedRows adds record rows.
func (*StatementContext) AddFoundRows ¶
func (sc *StatementContext) AddFoundRows(rows uint64)
AddFoundRows adds found rows.
func (*StatementContext) AddRecordRows ¶
func (sc *StatementContext) AddRecordRows(rows uint64)
AddRecordRows adds record rows.
func (*StatementContext) AddTouchedRows ¶
func (sc *StatementContext) AddTouchedRows(rows uint64)
AddTouchedRows adds touched rows.
func (*StatementContext) AddUpdatedRows ¶
func (sc *StatementContext) AddUpdatedRows(rows uint64)
AddUpdatedRows adds updated rows.
func (*StatementContext) AffectedRows ¶
func (sc *StatementContext) AffectedRows() uint64
AffectedRows gets affected rows.
func (*StatementContext) AppendError ¶
func (sc *StatementContext) AppendError(warn error)
AppendError appends a warning with level 'Error'.
func (*StatementContext) AppendExtraError ¶
func (sc *StatementContext) AppendExtraError(warn error)
AppendExtraError appends an extra warning with level 'Error'.
func (*StatementContext) AppendExtraNote ¶
func (sc *StatementContext) AppendExtraNote(warn error)
AppendExtraNote appends an extra warning with level 'Note'.
func (*StatementContext) AppendExtraWarning ¶
func (sc *StatementContext) AppendExtraWarning(warn error)
AppendExtraWarning appends an extra warning with level 'Warning'.
func (*StatementContext) AppendNote ¶
func (sc *StatementContext) AppendNote(warn error)
AppendNote appends a warning with level 'Note'.
func (*StatementContext) AppendWarning ¶
func (sc *StatementContext) AppendWarning(warn error)
AppendWarning appends a warning with level 'Warning'.
func (*StatementContext) AppendWarnings ¶
func (sc *StatementContext) AppendWarnings(warns []SQLWarn)
AppendWarnings appends some warnings.
func (*StatementContext) ClearUseChunkAlloc ¶
func (sc *StatementContext) ClearUseChunkAlloc()
ClearUseChunkAlloc clear useChunkAlloc status
func (*StatementContext) CopTasksDetails ¶
func (sc *StatementContext) CopTasksDetails() *CopTasksDetails
CopTasksDetails returns some useful information of cop-tasks during execution.
func (*StatementContext) CopiedRows ¶
func (sc *StatementContext) CopiedRows() uint64
CopiedRows is used to generate info message
func (*StatementContext) DeletedRows ¶
func (sc *StatementContext) DeletedRows() uint64
DeletedRows is used to generate info message
func (*StatementContext) FoundRows ¶
func (sc *StatementContext) FoundRows() uint64
FoundRows gets found rows.
func (*StatementContext) GetBinaryPlan ¶
func (sc *StatementContext) GetBinaryPlan() string
GetBinaryPlan gets the binaryPlan field of stmtctx
func (*StatementContext) GetEncodedPlan ¶
func (sc *StatementContext) GetEncodedPlan() string
GetEncodedPlan gets the encoded plan, it is used to avoid repeated encode.
func (*StatementContext) GetExecDetails ¶
func (sc *StatementContext) GetExecDetails() execdetails.ExecDetails
GetExecDetails gets the execution details for the statement.
func (*StatementContext) GetExtraWarnings ¶
func (sc *StatementContext) GetExtraWarnings() []SQLWarn
GetExtraWarnings gets extra warnings.
func (*StatementContext) GetFlatPlan ¶
func (sc *StatementContext) GetFlatPlan() interface{}
GetFlatPlan gets the flatPlan field of stmtctx
func (*StatementContext) GetLockWaitStartTime ¶
func (sc *StatementContext) GetLockWaitStartTime() time.Time
GetLockWaitStartTime returns the statement pessimistic lock wait start time
func (*StatementContext) GetMessage ¶
func (sc *StatementContext) GetMessage() string
GetMessage returns the extra message of the last executed command, if there is no message, it returns empty string
func (*StatementContext) GetOrEvaluateStmtCache ¶
func (sc *StatementContext) GetOrEvaluateStmtCache(key StmtCacheKey, valueEvaluator func() (interface{}, error)) (interface{}, error)
GetOrEvaluateStmtCache gets the cached value of the given key if it exists, otherwise calculate the value.
func (*StatementContext) GetOrStoreStmtCache ¶
func (sc *StatementContext) GetOrStoreStmtCache(key StmtCacheKey, value interface{}) interface{}
GetOrStoreStmtCache gets the cached value of the given key if it exists, otherwise stores the value.
func (*StatementContext) GetPlan ¶
func (sc *StatementContext) GetPlan() interface{}
GetPlan gets the plan field of stmtctx
func (*StatementContext) GetPlanDigest ¶
func (sc *StatementContext) GetPlanDigest() (normalized string, planDigest *parser.Digest)
GetPlanDigest gets the normalized plan and plan digest.
func (*StatementContext) GetPlanHint ¶
func (sc *StatementContext) GetPlanHint() (string, bool)
GetPlanHint gets the hint string generated from the plan.
func (*StatementContext) GetResourceGroupTagger ¶
func (sc *StatementContext) GetResourceGroupTagger() tikvrpc.ResourceGroupTagger
GetResourceGroupTagger returns the implementation of tikvrpc.ResourceGroupTagger related to self.
func (*StatementContext) GetUseChunkAllocStatus ¶
func (sc *StatementContext) GetUseChunkAllocStatus() bool
GetUseChunkAllocStatus returns useChunkAlloc status
func (*StatementContext) GetWarnings ¶
func (sc *StatementContext) GetWarnings() []SQLWarn
GetWarnings gets warnings.
func (*StatementContext) HandleOverflow ¶
func (sc *StatementContext) HandleOverflow(err error, warnErr error) error
HandleOverflow treats ErrOverflow as warnings or returns the error based on the StmtCtx.OverflowAsWarning state.
func (*StatementContext) HandleTruncate ¶
func (sc *StatementContext) HandleTruncate(err error) error
HandleTruncate ignores or returns the error based on the StatementContext state.
func (*StatementContext) InitDiskTracker ¶
func (sc *StatementContext) InitDiskTracker(label int, bytesLimit int64)
InitDiskTracker initializes the sc.DiskTracker, use cache to avoid allocation.
func (*StatementContext) InitMemTracker ¶
func (sc *StatementContext) InitMemTracker(label int, bytesLimit int64)
InitMemTracker initializes the sc.MemTracker, use cache to avoid allocation.
func (*StatementContext) InitSQLDigest ¶
func (sc *StatementContext) InitSQLDigest(normalized string, digest *parser.Digest)
InitSQLDigest sets the normalized and digest for sql.
func (*StatementContext) MergeExecDetails ¶
func (sc *StatementContext) MergeExecDetails(details *execdetails.ExecDetails, commitDetails *util.CommitDetails)
MergeExecDetails merges a single region execution details into self, used to print the information in slow query log.
func (*StatementContext) MergeLockKeysExecDetails ¶
func (sc *StatementContext) MergeLockKeysExecDetails(lockKeys *util.LockKeysDetails)
MergeLockKeysExecDetails merges lock keys execution details into self.
func (*StatementContext) MergeScanDetail ¶
func (sc *StatementContext) MergeScanDetail(scanDetail *util.ScanDetail)
MergeScanDetail merges scan details into self.
func (*StatementContext) MergeTimeDetail ¶
func (sc *StatementContext) MergeTimeDetail(timeDetail util.TimeDetail)
MergeTimeDetail merges time details into self.
func (*StatementContext) NumErrorWarnings ¶
func (sc *StatementContext) NumErrorWarnings() (ec uint16, wc int)
NumErrorWarnings gets warning and error count.
func (*StatementContext) PushDownFlags ¶
func (sc *StatementContext) PushDownFlags() uint64
PushDownFlags converts StatementContext to tipb.SelectRequest.Flags.
func (*StatementContext) RecordRangeFallback ¶
func (sc *StatementContext) RecordRangeFallback(rangeMaxSize int64)
RecordRangeFallback records range fallback.
func (*StatementContext) RecordRows ¶
func (sc *StatementContext) RecordRows() uint64
RecordRows is used to generate info message
func (*StatementContext) ResetForRetry ¶
func (sc *StatementContext) ResetForRetry()
ResetForRetry resets the changed states during execution.
func (*StatementContext) ResetInStmtCache ¶
func (sc *StatementContext) ResetInStmtCache(key StmtCacheKey)
ResetInStmtCache resets the cache of given key.
func (*StatementContext) ResetSQLDigest ¶
func (sc *StatementContext) ResetSQLDigest(s string)
ResetSQLDigest sets the normalized and digest for sql anyway, **DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING NOW**.
func (*StatementContext) ResetStmtCache ¶
func (sc *StatementContext) ResetStmtCache()
ResetStmtCache resets all cached values.
func (*StatementContext) SQLDigest ¶
func (sc *StatementContext) SQLDigest() (normalized string, sqlDigest *parser.Digest)
SQLDigest gets normalized and digest for provided sql. it will cache result after first calling.
func (*StatementContext) SetAffectedRows ¶
func (sc *StatementContext) SetAffectedRows(rows uint64)
SetAffectedRows sets affected rows.
func (*StatementContext) SetBinaryPlan ¶
func (sc *StatementContext) SetBinaryPlan(binaryPlan string)
SetBinaryPlan sets the binaryPlan field of stmtctx
func (*StatementContext) SetEncodedPlan ¶
func (sc *StatementContext) SetEncodedPlan(encodedPlan string)
SetEncodedPlan sets the encoded plan, it is used to avoid repeated encode.
func (*StatementContext) SetExtraWarnings ¶
func (sc *StatementContext) SetExtraWarnings(warns []SQLWarn)
SetExtraWarnings sets extra warnings.
func (*StatementContext) SetFlagsFromPBFlag ¶
func (sc *StatementContext) SetFlagsFromPBFlag(flags uint64)
SetFlagsFromPBFlag set the flag of StatementContext from a `tipb.SelectRequest.Flags`.
func (*StatementContext) SetFlatPlan ¶
func (sc *StatementContext) SetFlatPlan(flat interface{})
SetFlatPlan sets the flatPlan field of stmtctx
func (*StatementContext) SetMessage ¶
func (sc *StatementContext) SetMessage(msg string)
SetMessage sets the info message generated by some commands
func (*StatementContext) SetPlan ¶
func (sc *StatementContext) SetPlan(plan interface{})
SetPlan sets the plan field of stmtctx
func (*StatementContext) SetPlanDigest ¶
func (sc *StatementContext) SetPlanDigest(normalized string, planDigest *parser.Digest)
SetPlanDigest sets the normalized plan and plan digest.
func (*StatementContext) SetPlanHint ¶
func (sc *StatementContext) SetPlanHint(hint string)
SetPlanHint sets the hint for the plan.
func (*StatementContext) SetSkipPlanCache ¶
func (sc *StatementContext) SetSkipPlanCache(reason error)
SetSkipPlanCache sets to skip the plan cache and records the reason.
func (*StatementContext) SetUseChunkAlloc ¶
func (sc *StatementContext) SetUseChunkAlloc()
SetUseChunkAlloc set use chunk alloc status
func (*StatementContext) SetWarnings ¶
func (sc *StatementContext) SetWarnings(warns []SQLWarn)
SetWarnings sets warnings.
func (*StatementContext) ShouldClipToZero ¶
func (sc *StatementContext) ShouldClipToZero() bool
ShouldClipToZero indicates whether values less than 0 should be clipped to 0 for unsigned integer types. This is the case for `insert`, `update`, `alter table`, `create table` and `load data infile` statements, when not in strict SQL mode. see https://dev.mysql.com/doc/refman/5.7/en/out-of-range-and-overflow.html
func (*StatementContext) ShouldIgnoreOverflowError ¶
func (sc *StatementContext) ShouldIgnoreOverflowError() bool
ShouldIgnoreOverflowError indicates whether we should ignore the error when type conversion overflows, so we can leave it for further processing like clipping values less than 0 to 0 for unsigned integer types.
func (*StatementContext) TouchedRows ¶
func (sc *StatementContext) TouchedRows() uint64
TouchedRows is used to generate info message
func (*StatementContext) TruncateWarnings ¶
func (sc *StatementContext) TruncateWarnings(start int) []SQLWarn
TruncateWarnings truncates warnings begin from start and returns the truncated warnings.
func (*StatementContext) UpdatedRows ¶
func (sc *StatementContext) UpdatedRows() uint64
UpdatedRows is used to generate info message
func (*StatementContext) UseDynamicPartitionPrune ¶
func (sc *StatementContext) UseDynamicPartitionPrune() bool
UseDynamicPartitionPrune indicates whether dynamic partition is used during the query
func (*StatementContext) WarningCount ¶
func (sc *StatementContext) WarningCount() uint16
WarningCount gets warning count.
type StatsLoadResult ¶
type StatsLoadResult struct { Item model.TableItemID Error error }
StatsLoadResult indicates result for StatsLoad
func (StatsLoadResult) ErrorMsg ¶
func (r StatsLoadResult) ErrorMsg() string
ErrorMsg returns StatsLoadResult err msg
func (StatsLoadResult) HasError ¶
func (r StatsLoadResult) HasError() bool
HasError returns whether result has error
type StmtCacheKey ¶
type StmtCacheKey int
StmtCacheKey represents the key type in the StmtCache.
const ( // StmtNowTsCacheKey is a variable for now/current_timestamp calculation/cache of one stmt. StmtNowTsCacheKey StmtCacheKey = iota // StmtSafeTSCacheKey is a variable for safeTS calculation/cache of one stmt. StmtSafeTSCacheKey // StmtExternalTSCacheKey is a variable for externalTS calculation/cache of one stmt. StmtExternalTSCacheKey )
type StmtHints ¶
type StmtHints struct { // Hint Information MemQuotaQuery int64 ApplyCacheCapacity int64 MaxExecutionTime uint64 ReplicaRead byte AllowInSubqToJoinAndAgg bool NoIndexMergeHint bool StraightJoinOrder bool // EnableCascadesPlanner is use cascades planner for a single query only. EnableCascadesPlanner bool // ForceNthPlan indicates the PlanCounterTp number for finding physical plan. // -1 for disable. ForceNthPlan int64 // Hint flags HasAllowInSubqToJoinAndAggHint bool HasMemQuotaHint bool HasReplicaReadHint bool HasMaxExecutionTime bool HasEnableCascadesPlannerHint bool SetVars map[string]string // the original table hints OriginalTableHints []*ast.TableOptimizerHint }
StmtHints are SessionVars related sql hints.
func (*StmtHints) TaskMapNeedBackUp ¶
TaskMapNeedBackUp indicates that whether we need to back up taskMap during physical optimizing.
type TableEntry ¶
TableEntry presents table in db.