Documentation
¶
Index ¶
- Constants
- func AggregateGroupByCols(groupByCols []string) []string
- func ConvertGeneticCandidates(candidates []*IndexCandidate) []*genetic.IndexCandidate
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Decorrelate(expr *parser.Expression, outerSchema []ColumnInfo) (*parser.Expression, map[string]string)
- func DefaultGeneticAlgorithmConfig() *genetic.GeneticAlgorithmConfig
- func EstimateSampleSize(totalRows int64, confidenceLevel float64, marginOfError float64) int64
- func ExplainPlan(physicalPlan PhysicalPlan) string
- func ExplainPlanV2(p *plan.Plan) string
- func IsDebugEnabled() bool
- func IsFilterable(ds domain.DataSource) bool
- func IsUpdatable(viewInfo *domain.ViewInfo) bool
- func NewGeneticAlgorithm(config *genetic.GeneticAlgorithmConfig) *genetic.GeneticAlgorithm
- func RegisterProcessListProvider(provider ProcessListProvider)
- func ReplaceCorrelatedColumns(expr *parser.Expression, mapping map[string]string) *parser.Expression
- func SQLFingerprint(stmt *parser.SQLStatement) uint64
- func SelectionConditions(conditions []*parser.Expression) []*parser.Expression
- func SetDebug(enabled bool)
- func UnionAll(all bool) bool
- func UnionUnionType(unionType string) string
- type AdaptiveStatisticsCollector
- func (asc *AdaptiveStatisticsCollector) CollectStatistics(ctx context.Context, tableName string) (*TableStatistics, error)
- func (asc *AdaptiveStatisticsCollector) Explain() string
- func (asc *AdaptiveStatisticsCollector) GetSuggestedInterval(tableName string) time.Duration
- func (asc *AdaptiveStatisticsCollector) SetUpdateFrequency(tableName string, frequency float64)
- type AggregationAlgorithm
- type AggregationItem
- type AggregationType
- type BatchExecutor
- type BushyTreeAdapter
- type CachedPlan
- type CardinalityEstimator
- type ColumnInfo
- type ColumnPruningRule
- type ColumnStatistics
- type ConstantFoldingRule
- type CorrelatedColumn
- type CostModel
- type DPJoinReorderAdapter
- type DecorrelateRule
- type DefaultCostModel
- func (cm *DefaultCostModel) AggregateCost(inputRows int64, groupByCols int) float64
- func (cm *DefaultCostModel) FilterCost(inputRows int64, selectivity float64) float64
- func (cm *DefaultCostModel) JoinCost(leftRows, rightRows int64, joinType JoinType) float64
- func (cm *DefaultCostModel) ProjectCost(inputRows int64, projCols int) float64
- func (cm *DefaultCostModel) ScanCost(tableName string, rowCount int64) float64
- type DefaultShowProcessor
- func (sp *DefaultShowProcessor) ProcessShowColumns(ctx context.Context, tableName string) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowCreateTable(ctx context.Context, tableName string) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowDatabases(ctx context.Context) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowIndex(ctx context.Context, tableName string) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowProcessList(ctx context.Context) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowStatus(ctx context.Context) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowTables(ctx context.Context) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) ProcessShowVariables(ctx context.Context) (executor.ResultSet, error)
- func (sp *DefaultShowProcessor) SetCurrentDB(dbName string)
- func (sp *DefaultShowProcessor) SetProcessListProvider(provider ProcessListProvider)
- type DefaultVariableManager
- func (vm *DefaultVariableManager) EvaluateSystemVariable(varName string) (interface{}, error)
- func (vm *DefaultVariableManager) GetVariable(name string) (interface{}, bool)
- func (vm *DefaultVariableManager) GetVariableNames() []string
- func (vm *DefaultVariableManager) ListVariables() map[string]interface{}
- func (vm *DefaultVariableManager) SetVariable(name string, value interface{}) error
- type DeltaBuffer
- type DeriveTopNFromWindowRule
- type EnhancedCardinalityEstimator
- func (e *EnhancedCardinalityEstimator) EstimateDistinct(table string, columns []string) int64
- func (e *EnhancedCardinalityEstimator) EstimateFilter(table string, filters []domain.Filter) int64
- func (e *EnhancedCardinalityEstimator) EstimateJoin(left, right LogicalPlan, joinType JoinType) int64
- func (e *EnhancedCardinalityEstimator) EstimateTableScan(tableName string) int64
- func (e *EnhancedCardinalityEstimator) Explain() string
- func (e *EnhancedCardinalityEstimator) UpdateStatistics(tableName string, stats *TableStatistics)
- type EnhancedColumnPruningRule
- type EnhancedLogicalSort
- type EnhancedOptimizer
- func (eo *EnhancedOptimizer) Explain() string
- func (eo *EnhancedOptimizer) GetParallelism() int
- func (eo *EnhancedOptimizer) GetStatisticsCache() *statistics.AutoRefreshStatisticsCache
- func (eo *EnhancedOptimizer) Optimize(ctx context.Context, stmt *parser.SQLStatement) (*plan.Plan, error)
- func (eo *EnhancedOptimizer) SetParallelism(parallelism int)
- type EnhancedPredicatePushdownRule
- func (r *EnhancedPredicatePushdownRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *EnhancedPredicatePushdownRule) Explain(result LogicalPlan) string
- func (r *EnhancedPredicatePushdownRule) Match(plan LogicalPlan) bool
- func (r *EnhancedPredicatePushdownRule) Name() string
- type EnhancedTableStatistics
- type ExpressionEvaluator
- type ExpressionExecutor
- type Filter
- type FullTextIndexCandidate
- type FullTextIndexSupport
- func (fts *FullTextIndexSupport) CalculateFullTextSearchBenefit(rowCount int64, searchTermLength int, exactMatch bool) float64
- func (fts *FullTextIndexSupport) EstimateFullTextIndexStats(tableName string, columns []string, rowCount int64) *HypotheticalIndexStats
- func (fts *FullTextIndexSupport) ExtractFullTextIndexCandidates(tableName string, expression string, columnTypes map[string]string) []*IndexCandidate
- func (fts *FullTextIndexSupport) GetFullTextIndexDDL(tableName string, columns []string, indexName string) string
- func (fts *FullTextIndexSupport) IsColumnTypeCompatible(columnType string) bool
- func (fts *FullTextIndexSupport) IsFullTextExpression(expr string) bool
- func (fts *FullTextIndexSupport) IsStopWord(word string) bool
- func (fts *FullTextIndexSupport) OptimizeFullTextQuery(query string, tables map[string]bool) []string
- func (fts *FullTextIndexSupport) TokenizeText(text string) []string
- type GeneticAlgorithm
- type GeneticAlgorithmConfig
- type HintAwareAggRule
- func (r *HintAwareAggRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *HintAwareAggRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, ...) (LogicalPlan, error)
- func (r *HintAwareAggRule) Match(plan LogicalPlan) bool
- func (r *HintAwareAggRule) Name() string
- type HintAwareIndexRule
- func (r *HintAwareIndexRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *HintAwareIndexRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, ...) (LogicalPlan, error)
- func (r *HintAwareIndexRule) Match(plan LogicalPlan) bool
- func (r *HintAwareIndexRule) Name() string
- type HintAwareJoinReorderRule
- func (r *HintAwareJoinReorderRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *HintAwareJoinReorderRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, ...) (LogicalPlan, error)
- func (r *HintAwareJoinReorderRule) Match(plan LogicalPlan) bool
- func (r *HintAwareJoinReorderRule) Name() string
- type HintAwareJoinTypeHintRule
- func (r *HintAwareJoinTypeHintRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *HintAwareJoinTypeHintRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, ...) (LogicalPlan, error)
- func (r *HintAwareJoinTypeHintRule) Match(plan LogicalPlan) bool
- func (r *HintAwareJoinTypeHintRule) Name() string
- type HintAwareRule
- type HintAwareSubqueryRule
- func (r *HintAwareSubqueryRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *HintAwareSubqueryRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, ...) (LogicalPlan, error)
- func (r *HintAwareSubqueryRule) Match(plan LogicalPlan) bool
- func (r *HintAwareSubqueryRule) Name() string
- type Histogram
- type HistogramBucket
- type HypotheticalIndex
- type HypotheticalIndexDisplay
- type HypotheticalIndexStats
- type HypotheticalIndexStore
- func (s *HypotheticalIndexStore) Clear()
- func (s *HypotheticalIndexStore) Count() int
- func (s *HypotheticalIndexStore) CreateIndex(tableName string, columns []string, isUnique, isPrimary bool) (*HypotheticalIndex, error)
- func (s *HypotheticalIndexStore) DeleteIndex(indexID string) error
- func (s *HypotheticalIndexStore) DeleteTableIndexes(tableName string) int
- func (s *HypotheticalIndexStore) FindIndexByColumns(tableName string, columns []string) (*HypotheticalIndex, bool)
- func (s *HypotheticalIndexStore) GetIndex(indexID string) (*HypotheticalIndex, bool)
- func (s *HypotheticalIndexStore) GetTableIndexes(tableName string) []*HypotheticalIndex
- func (s *HypotheticalIndexStore) ListAllIndexes() []*HypotheticalIndex
- func (s *HypotheticalIndexStore) UpdateStats(indexID string, stats *HypotheticalIndexStats) error
- type HypotheticalStatsGenerator
- func (g *HypotheticalStatsGenerator) CompareWithFullScan(indexStats *HypotheticalIndexStats, rowCount int64) (float64, bool)
- func (g *HypotheticalStatsGenerator) EstimateIndexJoinCost(leftStats, rightStats *HypotheticalIndexStats, leftRows, rightRows int64) float64
- func (g *HypotheticalStatsGenerator) EstimateIndexScanCost(stats *HypotheticalIndexStats, rowCount int64) float64
- func (g *HypotheticalStatsGenerator) GenerateStats(tableName string, columns []string, isUnique bool) (*HypotheticalIndexStats, error)
- func (g *HypotheticalStatsGenerator) GetColumnStatistics(tableName, columnName string) (*statistics.ColumnStatistics, error)
- func (g *HypotheticalStatsGenerator) UpdateTableInfo(tableName string, info *domain.TableInfo)
- type IncrementalStatisticsCollector
- func (isc *IncrementalStatisticsCollector) CollectStatistics(ctx context.Context, tableName string) (*TableStatistics, error)
- func (isc *IncrementalStatisticsCollector) EstimateStatisticsAccuracy(tableName string) float64
- func (isc *IncrementalStatisticsCollector) FlushAllBuffers(ctx context.Context) error
- func (isc *IncrementalStatisticsCollector) GetDeltaBufferSize(tableName string) int64
- func (isc *IncrementalStatisticsCollector) RecordDelete(tableName string, rowCount int64)
- func (isc *IncrementalStatisticsCollector) RecordInsert(tableName string, rowCount int64)
- func (isc *IncrementalStatisticsCollector) RecordUpdate(tableName string, rowCount int64, modifiedColumns []string)
- func (isc *IncrementalStatisticsCollector) ShouldCollect(tableName string) bool
- type Index
- type IndexAdvisor
- func (ia *IndexAdvisor) Clear()
- func (ia *IndexAdvisor) GetHypotheticalIndexStore() *HypotheticalIndexStore
- func (ia *IndexAdvisor) GetMergeStatements(merges []*IndexMerge) []string
- func (ia *IndexAdvisor) RecommendForSingleQuery(ctx context.Context, query string, tableInfo map[string]*domain.TableInfo) ([]*IndexRecommendation, error)
- func (ia *IndexAdvisor) RecommendForWorkload(ctx context.Context, queries []string, tableInfo map[string]*domain.TableInfo) ([]*IndexRecommendation, error)
- func (ia *IndexAdvisor) RecommendMergedIndexes(existingIndexes []*Index, candidates []*IndexCandidate) ([]*IndexMerge, error)
- func (ia *IndexAdvisor) Run(ctx context.Context, query string, tableInfo map[string]*domain.TableInfo) ([]*IndexRecommendation, error)
- func (ia *IndexAdvisor) SetIndexMerger(merger *IndexMerger)
- func (ia *IndexAdvisor) SetStatisticsIntegrator(integrator *StatisticsIntegrator)
- type IndexAdvisorResult
- type IndexCandidate
- type IndexCandidateExtractor
- func (e *IndexCandidateExtractor) ExtractForTable(candidates []*IndexCandidate, tableName string) []*IndexCandidate
- func (e *IndexCandidateExtractor) ExtractFromSQL(stmt *parser.SQLStatement, tableInfo map[string]*domain.TableInfo) ([]*IndexCandidate, error)
- func (e *IndexCandidateExtractor) FilterByColumnType(candidates []*IndexCandidate, tableInfo map[string]*domain.TableInfo) []*IndexCandidate
- func (e *IndexCandidateExtractor) GetColumnInfo(tableInfo map[string]*domain.TableInfo, tableName, columnName string) (string, bool)
- func (e *IndexCandidateExtractor) MergeCandidates(candidates []*IndexCandidate) []*IndexCandidate
- type IndexCostEstimator
- func (ice *IndexCostEstimator) AdjustCostForSkew(cost float64, skewFactor float64) float64
- func (ice *IndexCostEstimator) EstimateAggregateCost(rowCount int64, groupByColumns []string, indexStats *HypotheticalIndexStats, ...) float64
- func (ice *IndexCostEstimator) EstimateBenefit(baseCost float64, indexCost float64) float64
- func (ice *IndexCostEstimator) EstimateCardinality(ndv float64, selectivity float64, rowCount int64) int64
- func (ice *IndexCostEstimator) EstimateIndexLookupCost(indexStats *HypotheticalIndexStats, rowCount int64) float64
- func (ice *IndexCostEstimator) EstimateIndexRangeScanCost(indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64) float64
- func (ice *IndexCostEstimator) EstimateIndexScanCost(indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64) float64
- func (ice *IndexCostEstimator) EstimateJoinCost(outerRowCount int64, innerRowCount int64, ...) float64
- func (ice *IndexCostEstimator) EstimateMultiColumnIndexCost(indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64, ...) float64
- func (ice *IndexCostEstimator) EstimateRangeSelectivity(ndv float64, rowCount int64, condition *parser.Expression) float64
- func (ice *IndexCostEstimator) EstimateSelectivityFromNDV(ndv float64, rowCount int64) float64
- type IndexManager
- func (im *IndexManager) AddIndex(index *Index)
- func (im *IndexManager) FindBestIndex(tableName string, columns []string) *Index
- func (im *IndexManager) GetIndexStats(indexName string) *IndexStats
- func (im *IndexManager) GetIndices(tableName string) []*Index
- func (im *IndexManager) RecordIndexAccess(indexName string, duration time.Duration)
- type IndexMerge
- type IndexMerger
- func (im *IndexMerger) CalculateMergeBenefit(before []*MergerIndex, after []*MergerIndex) float64
- func (im *IndexMerger) CalculateSpaceSavings(merges []IndexMerge) int64
- func (im *IndexMerger) ExplainMerge(merge IndexMerge) string
- func (im *IndexMerger) FindMergeableIndexes(existingIndexes []*Index, candidates []*IndexCandidate) []IndexMerge
- func (im *IndexMerger) GenerateMergeStatements(merges []IndexMerge) []string
- func (im *IndexMerger) GetRecommendedMerges(existingIndexes []*Index, candidates []*IndexCandidate) []*IndexMerge
- func (im *IndexMerger) MergeIndexes(indexes []*MergerIndex) *MergerIndex
- type IndexRecommendation
- type IndexSelectionAdapter
- type IndexSelector
- type IndexStats
- type JoinCondition
- type JoinEliminationRule
- type JoinReorderRule
- type JoinType
- type LimitInfo
- type LimitPushDownRule
- type LogicalAggregate
- func (p *LogicalAggregate) Algorithm() AggregationAlgorithm
- func (p *LogicalAggregate) Children() []LogicalPlan
- func (p *LogicalAggregate) Explain() string
- func (p *LogicalAggregate) GetAggFuncs() []*AggregationItem
- func (p *LogicalAggregate) GetAppliedHints() []string
- func (p *LogicalAggregate) GetGroupBy() []string
- func (p *LogicalAggregate) GetGroupByCols() []string
- func (p *LogicalAggregate) Schema() []ColumnInfo
- func (p *LogicalAggregate) SetAlgorithm(algo AggregationAlgorithm)
- func (p *LogicalAggregate) SetChildren(children ...LogicalPlan)
- func (p *LogicalAggregate) SetHintApplied(hint string)
- type LogicalApply
- func (p *LogicalApply) Children() []LogicalPlan
- func (p *LogicalApply) CorrelatedColumns() []CorrelatedColumn
- func (p *LogicalApply) Explain() string
- func (p *LogicalApply) GetConditions() []*parser.Expression
- func (p *LogicalApply) GetJoinType() JoinType
- func (p *LogicalApply) Schema() []ColumnInfo
- func (p *LogicalApply) SetChildren(children ...LogicalPlan)
- func (p *LogicalApply) SetCorrelatedColumns(cols []CorrelatedColumn)
- type LogicalDataSource
- func (p *LogicalDataSource) Children() []LogicalPlan
- func (p *LogicalDataSource) Explain() string
- func (p *LogicalDataSource) ForceUseIndex(indexName string)
- func (p *LogicalDataSource) GetAppliedHints() []string
- func (p *LogicalDataSource) GetPushedDownLimit() *LimitInfo
- func (p *LogicalDataSource) GetPushedDownPredicates() []*parser.Expression
- func (p *LogicalDataSource) GetPushedDownTopN() *TopNInfo
- func (p *LogicalDataSource) IgnoreIndex(indexName string)
- func (p *LogicalDataSource) IgnoreOrderIndex(indexName string)
- func (p *LogicalDataSource) PreferIndex(indexName string)
- func (p *LogicalDataSource) PushDownLimit(limit, offset int64)
- func (p *LogicalDataSource) PushDownPredicates(conditions []*parser.Expression)
- func (p *LogicalDataSource) RowCount() int64
- func (p *LogicalDataSource) Schema() []ColumnInfo
- func (p *LogicalDataSource) SetChildren(children ...LogicalPlan)
- func (p *LogicalDataSource) SetHintApplied(hint string)
- func (p *LogicalDataSource) SetOrderIndex(indexName string)
- func (p *LogicalDataSource) SetPushDownTopN(items []*parser.OrderItem, limit, offset int64)
- func (p *LogicalDataSource) Table() string
- type LogicalDelete
- func (p *LogicalDelete) Children() []LogicalPlan
- func (p *LogicalDelete) Explain() string
- func (p *LogicalDelete) GetLimit() *int64
- func (p *LogicalDelete) GetOrderBy() []*parser.OrderItem
- func (p *LogicalDelete) GetTableName() string
- func (p *LogicalDelete) GetWhere() *parser.Expression
- func (p *LogicalDelete) Schema() []ColumnInfo
- func (p *LogicalDelete) SetChildren(children ...LogicalPlan)
- func (p *LogicalDelete) SetLimit(limit *int64)
- func (p *LogicalDelete) SetOrderBy(orderBy []*parser.OrderItem)
- func (p *LogicalDelete) SetWhere(where *parser.Expression)
- type LogicalInsert
- func (p *LogicalInsert) Children() []LogicalPlan
- func (p *LogicalInsert) Explain() string
- func (p *LogicalInsert) GetColumns() []string
- func (p *LogicalInsert) GetSelectPlan() LogicalPlan
- func (p *LogicalInsert) GetTableName() string
- func (p *LogicalInsert) GetValues() [][]parser.Expression
- func (p *LogicalInsert) HasSelect() bool
- func (p *LogicalInsert) Schema() []ColumnInfo
- func (p *LogicalInsert) SetChildren(children ...LogicalPlan)
- func (p *LogicalInsert) SetOnDuplicate(update *LogicalUpdate)
- type LogicalJoin
- func (p *LogicalJoin) Children() []LogicalPlan
- func (p *LogicalJoin) Explain() string
- func (p *LogicalJoin) GetConditions() []*parser.Expression
- func (p *LogicalJoin) GetJoinConditions() []*JoinCondition
- func (p *LogicalJoin) GetJoinType() JoinType
- func (p *LogicalJoin) Schema() []ColumnInfo
- func (p *LogicalJoin) SetChildren(children ...LogicalPlan)
- func (p *LogicalJoin) SetHintApplied(hintType string)
- type LogicalLimit
- type LogicalPlan
- type LogicalProjection
- func (p *LogicalProjection) Children() []LogicalPlan
- func (p *LogicalProjection) Explain() string
- func (p *LogicalProjection) GetAliases() []string
- func (p *LogicalProjection) GetExprs() []*parser.Expression
- func (p *LogicalProjection) Schema() []ColumnInfo
- func (p *LogicalProjection) SetChildren(children ...LogicalPlan)
- type LogicalSelection
- func (p *LogicalSelection) Children() []LogicalPlan
- func (p *LogicalSelection) Conditions() []*parser.Expression
- func (p *LogicalSelection) Explain() string
- func (p *LogicalSelection) GetConditions() []*parser.Expression
- func (p *LogicalSelection) Schema() []ColumnInfo
- func (p *LogicalSelection) Selectivity() float64
- func (p *LogicalSelection) SetChildren(children ...LogicalPlan)
- type LogicalSort
- type LogicalTopN
- func (p *LogicalTopN) Children() []LogicalPlan
- func (p *LogicalTopN) Explain() string
- func (p *LogicalTopN) GetLimit() int64
- func (p *LogicalTopN) GetOffset() int64
- func (p *LogicalTopN) Schema() []ColumnInfo
- func (p *LogicalTopN) SetChildren(children ...LogicalPlan)
- func (p *LogicalTopN) SetLimit(limit int64)
- func (p *LogicalTopN) SetOffset(offset int64)
- func (p *LogicalTopN) SortItems() []*parser.OrderItem
- type LogicalUnion
- type LogicalUpdate
- func (p *LogicalUpdate) Children() []LogicalPlan
- func (p *LogicalUpdate) Explain() string
- func (p *LogicalUpdate) GetLimit() *int64
- func (p *LogicalUpdate) GetOrderBy() []*parser.OrderItem
- func (p *LogicalUpdate) GetSet() map[string]parser.Expression
- func (p *LogicalUpdate) GetTableName() string
- func (p *LogicalUpdate) GetWhere() *parser.Expression
- func (p *LogicalUpdate) Schema() []ColumnInfo
- func (p *LogicalUpdate) SetChildren(children ...LogicalPlan)
- func (p *LogicalUpdate) SetLimit(limit *int64)
- func (p *LogicalUpdate) SetOrderBy(orderBy []*parser.OrderItem)
- func (p *LogicalUpdate) SetWhere(where *parser.Expression)
- type LogicalVectorScan
- type LogicalWindow
- type MaxMinEliminationRule
- type MemoryPool
- type MergerIndex
- type ORToUnionRule
- type OptimizationContext
- type OptimizationRule
- type OptimizedAggregate
- func (p *OptimizedAggregate) Children() []PhysicalPlan
- func (p *OptimizedAggregate) Cost() float64
- func (p *OptimizedAggregate) Execute(ctx context.Context) (*domain.QueryResult, error)
- func (p *OptimizedAggregate) Explain() string
- func (p *OptimizedAggregate) Schema() []ColumnInfo
- func (p *OptimizedAggregate) SetChildren(children ...PhysicalPlan)
- type OptimizedExecutor
- func (e *OptimizedExecutor) ExecuteAlter(ctx context.Context, stmt *parser.AlterStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteCreate(ctx context.Context, stmt *parser.CreateStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteCreateIndex(ctx context.Context, stmt *parser.CreateIndexStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteDelete(ctx context.Context, stmt *parser.DeleteStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteDrop(ctx context.Context, stmt *parser.DropStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteDropIndex(ctx context.Context, stmt *parser.DropIndexStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteInsert(ctx context.Context, stmt *parser.InsertStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteSelect(ctx context.Context, stmt *parser.SelectStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteShow(ctx context.Context, showStmt *parser.ShowStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) ExecuteUpdate(ctx context.Context, stmt *parser.UpdateStatement) (*domain.QueryResult, error)
- func (e *OptimizedExecutor) GetCurrentDB() string
- func (e *OptimizedExecutor) GetCurrentUser() string
- func (e *OptimizedExecutor) GetOptimizer() *EnhancedOptimizer
- func (e *OptimizedExecutor) GetQueryBuilder() interface{}
- func (e *OptimizedExecutor) SetCurrentDB(dbName string)
- func (e *OptimizedExecutor) SetCurrentUser(user string)
- func (e *OptimizedExecutor) SetUseOptimizer(use bool)
- func (e *OptimizedExecutor) SetVirtualDBRegistry(registry *virtual.VirtualDatabaseRegistry)
- type OptimizedParallelScanner
- func (ops *OptimizedParallelScanner) Close() error
- func (ops *OptimizedParallelScanner) Execute(ctx context.Context, scanRange ScanRange, options *domain.QueryOptions) (*domain.QueryResult, error)
- func (ops *OptimizedParallelScanner) Explain() string
- func (ops *OptimizedParallelScanner) GetParallelism() int
- func (ops *OptimizedParallelScanner) SetParallelism(parallelism int)
- type Optimizer
- type OptimizerHints
- type OrderByHintRule
- func (r *OrderByHintRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (r *OrderByHintRule) EstimateSortCost(plan *LogicalSort, optCtx *OptimizationContext) float64
- func (r *OrderByHintRule) Explain() string
- func (r *OrderByHintRule) GetOrderByItems(plan *LogicalSort) []OrderByItem
- func (r *OrderByHintRule) GetRecommendedSortMethod(plan *LogicalSort, optCtx *OptimizationContext) string
- func (r *OrderByHintRule) Match(plan LogicalPlan) bool
- func (r *OrderByHintRule) Name() string
- type OrderByItem
- type PerformanceOptimizer
- func (po *PerformanceOptimizer) EstimateJoinSelectivity(leftTable, rightTable string, optCtx *OptimizationContext) float64
- func (po *PerformanceOptimizer) EstimateSelectivity(filter Filter, stats *Statistics) float64
- func (po *PerformanceOptimizer) OptimizeQuery(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
- func (po *PerformanceOptimizer) OptimizeScan(tableName string, filters []Filter, optCtx *OptimizationContext) *ScanOptimization
- type PhysicalHashAggregate
- type PhysicalHashJoin
- type PhysicalLimit
- type PhysicalMergeJoin
- func (p *PhysicalMergeJoin) Children() []PhysicalPlan
- func (p *PhysicalMergeJoin) Cost() float64
- func (p *PhysicalMergeJoin) Execute(ctx context.Context) (*domain.QueryResult, error)
- func (p *PhysicalMergeJoin) Explain() string
- func (p *PhysicalMergeJoin) Schema() []ColumnInfo
- func (p *PhysicalMergeJoin) SetChildren(children ...PhysicalPlan)
- type PhysicalPlan
- type PhysicalProjection
- type PhysicalSelection
- type PhysicalSort
- func (p *PhysicalSort) Children() []PhysicalPlan
- func (p *PhysicalSort) Cost() float64
- func (p *PhysicalSort) Execute(ctx context.Context) (*domain.QueryResult, error)
- func (p *PhysicalSort) Explain() string
- func (p *PhysicalSort) Schema() []ColumnInfo
- func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)
- type PhysicalTableScan
- type PlanCache
- func (pc *PlanCache) Get(fingerprint uint64) (*plan.Plan, bool)
- func (pc *PlanCache) Invalidate()
- func (pc *PlanCache) Put(fingerprint uint64, p *plan.Plan)
- func (pc *PlanCache) Size() int
- func (pc *PlanCache) Stats() (hits, misses int64)
- func (pc *PlanCache) UpdateCost(fingerprint uint64, actualCost float64)
- type PlanConverter
- type PlanNode
- type PredicatePushDownRule
- type PriorityQueue
- type ProcedureExecutor
- func (pe *ProcedureExecutor) ExecuteFunction(ctx context.Context, name string, args ...interface{}) (interface{}, error)
- func (pe *ProcedureExecutor) ExecuteProcedure(ctx context.Context, name string, args ...interface{}) ([]map[string]interface{}, error)
- func (pe *ProcedureExecutor) RegisterFunction(fn *parser.FunctionInfo) error
- func (pe *ProcedureExecutor) RegisterProcedure(proc *parser.ProcedureInfo) error
- type ProcessListProvider
- type ProjectionEliminationRule
- type PushDecision
- type RefreshTask
- type Result
- type RuleExecutor
- type RuleSet
- type ScanOptimization
- type ScanRange
- type ScanResult
- type Scope
- type SemiJoinRewriteRule
- type SessionVariableManager
- func (svm *SessionVariableManager) GetVariable(name string) (interface{}, bool)
- func (svm *SessionVariableManager) GetVariableNames() []string
- func (svm *SessionVariableManager) ListVariables() map[string]interface{}
- func (svm *SessionVariableManager) SetVariable(name string, value interface{}) error
- type ShowExecutor
- type SimpleCardinalityEstimator
- func (e *SimpleCardinalityEstimator) EstimateDistinct(table string, columns []string) int64
- func (e *SimpleCardinalityEstimator) EstimateFilter(table string, filters []domain.Filter) int64
- func (e *SimpleCardinalityEstimator) EstimateJoin(left, right LogicalPlan, joinType JoinType) int64
- func (e *SimpleCardinalityEstimator) EstimateTableScan(tableName string) int64
- func (e *SimpleCardinalityEstimator) UpdateStatistics(tableName string, stats *TableStatistics)
- type SimpleExpressionContext
- func (ctx *SimpleExpressionContext) GetCurrentTime() interface{}
- func (ctx *SimpleExpressionContext) GetFunction(funcName string) (interface{}, bool)
- func (ctx *SimpleExpressionContext) GetRowValue(colName string) (interface{}, bool)
- func (ctx *SimpleExpressionContext) GetVariable(varName string) (interface{}, bool)
- func (ctx *SimpleExpressionContext) SetVariable(name string, value interface{})
- type SpatialIndexCandidate
- type SpatialIndexSupport
- func (sis *SpatialIndexSupport) CalculateIndexSelectivity(funcName string, queryRange string, dataRange string) float64
- func (sis *SpatialIndexSupport) CalculateSpatialQueryBenefit(funcName string, rowCount int64, queryArea string) float64
- func (sis *SpatialIndexSupport) CanUseSpatialIndex(funcName string, args []string) bool
- func (sis *SpatialIndexSupport) EstimateMBRSize(subType string, estimatedSize int64) float64
- func (sis *SpatialIndexSupport) EstimateSpatialIndexStats(tableName string, columnName string, columnType string, rowCount int64) *HypotheticalIndexStats
- func (sis *SpatialIndexSupport) ExtractSpatialFunction(expr string) (string, []string)
- func (sis *SpatialIndexSupport) ExtractSpatialIndexCandidates(tableName string, expression string, columnTypes map[string]string) []*IndexCandidate
- func (sis *SpatialIndexSupport) GetSpatialIndexDDL(tableName string, columnName string, indexName string) string
- func (sis *SpatialIndexSupport) GetSpatialIndexSubType(columnType string) string
- func (sis *SpatialIndexSupport) IsColumnTypeCompatible(columnType string) bool
- func (sis *SpatialIndexSupport) IsSpatialExpression(expr string) bool
- func (sis *SpatialIndexSupport) OptimizeSpatialQuery(query string, tables map[string]bool) []string
- func (sis *SpatialIndexSupport) ValidateSpatialFunction(funcName string, args []string) error
- type Statistics
- type StatisticsCollector
- type StatisticsIntegrator
- func (si *StatisticsIntegrator) ClearCache()
- func (si *StatisticsIntegrator) EstimateCorrelationFromRealStats(tableName string, columns []string) (float64, error)
- func (si *StatisticsIntegrator) EstimateIndexSizeFromRealStats(tableName string, columns []string) (int64, error)
- func (si *StatisticsIntegrator) EstimateNDVFromRealStats(tableName, columnName string) (float64, error)
- func (si *StatisticsIntegrator) EstimateNDVFromRealStatsMultiColumn(tableName string, columns []string) (float64, error)
- func (si *StatisticsIntegrator) EstimateNullFractionFromRealStats(tableName, columnName string) (float64, error)
- func (si *StatisticsIntegrator) EstimateSelectivityFromRealStats(tableName, columnName string, filter interface{}) (float64, error)
- func (si *StatisticsIntegrator) GenerateIndexStatsFromRealStats(tableName string, columns []string, isUnique bool) (*HypotheticalIndexStats, error)
- func (si *StatisticsIntegrator) GetHistogram(tableName, columnName string) (*statistics.Histogram, error)
- func (si *StatisticsIntegrator) GetRealStatistics(tableName string) (*statistics.TableStatistics, error)
- func (si *StatisticsIntegrator) GetStatisticsSummary(tableName string) string
- type SubqueryFlatteningRule
- type SubqueryMaterializationRule
- type SystemViews
- func (sv *SystemViews) AddHypotheticalIndex(index HypotheticalIndexDisplay)
- func (sv *SystemViews) AddIndexAdvisorResult(result IndexAdvisorResult)
- func (sv *SystemViews) AddUnusedIndex(index UnusedIndex)
- func (sv *SystemViews) ClearAll()
- func (sv *SystemViews) ClearHypotheticalIndexes()
- func (sv *SystemViews) ClearIndexAdvisorResults()
- func (sv *SystemViews) ClearUnusedIndexes()
- func (sv *SystemViews) ConvertRecommendationsToSystemViews(recommendations []*IndexRecommendation, database string) []IndexAdvisorResult
- func (sv *SystemViews) GetHypotheticalIndexes() []HypotheticalIndexDisplay
- func (sv *SystemViews) GetHypotheticalIndexesForTable(tableName string) []HypotheticalIndexDisplay
- func (sv *SystemViews) GetIndexAdvisorResults() []IndexAdvisorResult
- func (sv *SystemViews) GetIndexAdvisorResultsForTable(tableName string) []IndexAdvisorResult
- func (sv *SystemViews) GetMaxResults() int
- func (sv *SystemViews) GetStatistics() map[string]int
- func (sv *SystemViews) GetTopRecommendedIndexes(limit int) []IndexAdvisorResult
- func (sv *SystemViews) GetUnusedIndexes() []UnusedIndex
- func (sv *SystemViews) GetUnusedIndexesForTable(tableName string) []UnusedIndex
- func (sv *SystemViews) HypotheticalIndexDisplayToRow(index HypotheticalIndexDisplay) []interface{}
- func (sv *SystemViews) IndexAdvisorResultToRow(result IndexAdvisorResult) []interface{}
- func (sv *SystemViews) QueryIndexAdvisorResults(filter map[string]interface{}) []IndexAdvisorResult
- func (sv *SystemViews) SetMaxResults(max int)
- func (sv *SystemViews) UnusedIndexToRow(index UnusedIndex) []interface{}
- type TableProfile
- type TableStatistics
- type TableTrigger
- type TableTriggerStats
- type TopNInfo
- type TopNPushDownRule
- type UnusedIndex
- type VectorIndexRule
- type VectorSearchInfo
- type ViewExecutor
- type ViewRewriter
- type WindowFunctionDef
- type WindowFunctionItem
- type WindowOperator
- type WriteRecord
- type WriteTriggerDataSource
- type WriteTriggerManager
- func (wtm *WriteTriggerManager) Explain() string
- func (wtm *WriteTriggerManager) ForceRefresh(tableName string) error
- func (wtm *WriteTriggerManager) GetAllStats() map[string]*TableTriggerStats
- func (wtm *WriteTriggerManager) GetWriteStats(tableName string) *TableTriggerStats
- func (wtm *WriteTriggerManager) OnWrite(tableName string, operation string, rowCount int64)
- func (wtm *WriteTriggerManager) RefreshAll() error
- func (wtm *WriteTriggerManager) RegisterTable(tableName string)
- func (wtm *WriteTriggerManager) SetRefreshInterval(interval time.Duration)
- func (wtm *WriteTriggerManager) SetTriggerThreshold(threshold int64)
- func (wtm *WriteTriggerManager) Stop()
- func (wtm *WriteTriggerManager) UnregisterTable(tableName string)
Constants ¶
const ( IndexTypeBTree = "BTREE" IndexTypeFullText = "FULLTEXT" IndexTypeSpatial = "SPATIAL" )
IndexType 索引类型常量
const ( SpatialFuncContains = "ST_Contains" SpatialFuncIntersects = "ST_Intersects" SpatialFuncWithin = "ST_Within" SpatialFuncOverlaps = "ST_Overlaps" SpatialFuncTouches = "ST_Touches" SpatialFuncCrosses = "ST_Crosses" SpatialFuncDistance = "ST_Distance" SpatialFuncArea = "ST_Area" SpatialFuncLength = "ST_Length" SpatialFuncBuffer = "ST_Buffer" )
SpatialFunction 空间函数类型
const ( FullTextFuncMatchAgainst = "MATCH_AGAINST" FullTextFuncFulltext = "FULLTEXT" )
FullTextFunction 全文函数类型
Variables ¶
This section is empty.
Functions ¶
func AggregateGroupByCols ¶
AggregateGroupByCols 分组列访问器
func ConvertGeneticCandidates ¶
func ConvertGeneticCandidates(candidates []*IndexCandidate) []*genetic.IndexCandidate
ConvertGeneticCandidates 转换遗传算法候选索引类型
func Debugf ¶ added in v0.3.1
func Debugf(format string, args ...interface{})
Debugf prints debug message if debug mode is enabled (public version for sub-packages)
func Debugln ¶ added in v0.3.1
func Debugln(args ...interface{})
Debugln prints debug line if debug mode is enabled (public version for sub-packages)
func Decorrelate ¶
func Decorrelate(expr *parser.Expression, outerSchema []ColumnInfo) (*parser.Expression, map[string]string)
Decorrelate decorrelate an expression by replacing correlated columns with join references Returns decorrelated expression and mapping used
func DefaultGeneticAlgorithmConfig ¶
func DefaultGeneticAlgorithmConfig() *genetic.GeneticAlgorithmConfig
DefaultGeneticAlgorithmConfig 返回默认配置 Deprecated: 已迁移到 pkg/optimizer/genetic 包,此函数仅为兼容性保留
func EstimateSampleSize ¶
EstimateSampleSize 估算需要的样本大小
func ExplainPlan ¶
func ExplainPlan(physicalPlan PhysicalPlan) string
ExplainPlan 解释执行计划(统一调用 ExplainPlanV2) 注意:PhysicalPlan 接口已被弃用,请使用 *plan.Plan
func IsDebugEnabled ¶
func IsDebugEnabled() bool
IsDebugEnabled returns whether debug logging is enabled.
func IsFilterable ¶
func IsFilterable(ds domain.DataSource) bool
IsFilterable 检查数据源是否支持过滤能力
该函数通过类型断言检测数据源是否实现了 FilterableDataSource 接口。 如果数据源支持过滤,优化器可以将过滤条件下推到数据源层面, 避免将所有数据加载到内存后再过滤。
参数:
- ds: 数据源实例
返回:
- true: 数据源支持过滤能力
- false: 数据源不支持过滤能力,需要在内存中过滤
使用示例:
if optimizer.IsFilterable(dataSource) {
// 将过滤器下推到数据源
rows, total, err := filterableDS.Filter(ctx, tableName, filter, offset, limit)
} else {
// 在内存中过滤
result, err := dataSource.Query(ctx, tableName, &domain.QueryOptions{})
rows = applyFilters(result.Rows, filter)
}
func IsUpdatable ¶
IsUpdatable checks if a view is updatable based on its definition
func NewGeneticAlgorithm ¶
func NewGeneticAlgorithm(config *genetic.GeneticAlgorithmConfig) *genetic.GeneticAlgorithm
NewGeneticAlgorithm 创建遗传算法实例 Deprecated: 已迁移到 pkg/optimizer/genetic 包,此函数仅为兼容性保留
func RegisterProcessListProvider ¶
func RegisterProcessListProvider(provider ProcessListProvider)
RegisterProcessListProvider 注册进程列表提供者
func ReplaceCorrelatedColumns ¶
func ReplaceCorrelatedColumns(expr *parser.Expression, mapping map[string]string) *parser.Expression
ReplaceCorrelatedColumns replaces correlated columns with join references Mapping: correlated_column_name -> new_column_name
func SQLFingerprint ¶
func SQLFingerprint(stmt *parser.SQLStatement) uint64
SQLFingerprint computes a FNV-1a hash of the SQL statement for cache lookup. This provides a fast, collision-resistant fingerprint for plan caching.
func SelectionConditions ¶
func SelectionConditions(conditions []*parser.Expression) []*parser.Expression
SelectionConditions 过滤条件访问器
Types ¶
type AdaptiveStatisticsCollector ¶
type AdaptiveStatisticsCollector struct {
// contains filtered or unexported fields
}
AdaptiveStatisticsCollector 自适应统计收集器 根据表的更新频率和大小动态调整收集策略
func NewAdaptiveStatisticsCollector ¶
func NewAdaptiveStatisticsCollector(baseCollector *IncrementalStatisticsCollector) *AdaptiveStatisticsCollector
NewAdaptiveStatisticsCollector 创建自适应统计收集器
func (*AdaptiveStatisticsCollector) CollectStatistics ¶
func (asc *AdaptiveStatisticsCollector) CollectStatistics(ctx context.Context, tableName string) (*TableStatistics, error)
CollectStatistics 自适应收集统计信息
func (*AdaptiveStatisticsCollector) Explain ¶
func (asc *AdaptiveStatisticsCollector) Explain() string
Explain 解释统计收集器
func (*AdaptiveStatisticsCollector) GetSuggestedInterval ¶
func (asc *AdaptiveStatisticsCollector) GetSuggestedInterval(tableName string) time.Duration
GetSuggestedInterval 获取建议的收集间隔
func (*AdaptiveStatisticsCollector) SetUpdateFrequency ¶
func (asc *AdaptiveStatisticsCollector) SetUpdateFrequency(tableName string, frequency float64)
SetUpdateFrequency 设置表的更新频率
type AggregationAlgorithm ¶
type AggregationAlgorithm int
AggregationAlgorithm 聚合算法类型
const ( // HashAggAlgorithm 哈希聚合 HashAggAlgorithm AggregationAlgorithm = iota // StreamAggAlgorithm 流式聚合 StreamAggAlgorithm // MPP1PhaseAggAlgorithm MPP 单阶段聚合 MPP1PhaseAggAlgorithm // MPP2PhaseAggAlgorithm MPP 两阶段聚合 MPP2PhaseAggAlgorithm )
func (AggregationAlgorithm) String ¶
func (aa AggregationAlgorithm) String() string
String 返回聚合算法的字符串表示
type AggregationItem ¶
type AggregationItem struct {
Type AggregationType
Expr *parser.Expression
Alias string
Distinct bool
}
AggregationItem 聚合项
func AggregateAggFuncs ¶
func AggregateAggFuncs(aggFuncs []*AggregationItem) []*AggregationItem
AggregateAggFuncs 聚合函数访问器
type AggregationType ¶
type AggregationType int
AggregationType 聚合函数类型
const ( Count AggregationType = iota Sum Avg Max Min )
func (AggregationType) String ¶
func (at AggregationType) String() string
String 返回 AggregationType 的字符串表示
type BatchExecutor ¶
type BatchExecutor struct {
// contains filtered or unexported fields
}
BatchExecutor 批量执行器
func NewBatchExecutor ¶
func NewBatchExecutor(batchSize int, flushInterval time.Duration, flushFunc func([]interface{}) error) *BatchExecutor
NewBatchExecutor 创建批量执行器
type BushyTreeAdapter ¶
type BushyTreeAdapter struct {
// contains filtered or unexported fields
}
BushyTreeAdapter Bushy Tree适配器
func (*BushyTreeAdapter) Apply ¶
func (a *BushyTreeAdapter) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
func (*BushyTreeAdapter) Match ¶
func (a *BushyTreeAdapter) Match(plan LogicalPlan) bool
func (*BushyTreeAdapter) Name ¶
func (a *BushyTreeAdapter) Name() string
type CachedPlan ¶
type CachedPlan struct {
Plan *plan.Plan
CreatedAt time.Time
HitCount int64
LastHit time.Time
ActualCost float64 // DQ reward feedback: actual execution cost
}
CachedPlan stores a cached execution plan with metadata.
type CardinalityEstimator ¶
type CardinalityEstimator interface {
// EstimateTableScan 估算表扫描的基数
EstimateTableScan(tableName string) int64
// EstimateFilter 估算过滤后的基数
EstimateFilter(table string, filters []domain.Filter) int64
// EstimateJoin 估算JOIN的输出行数
EstimateJoin(left, right LogicalPlan, joinType JoinType) int64
// EstimateDistinct 估算DISTINCT后的行数
EstimateDistinct(table string, columns []string) int64
// UpdateStatistics 更新表的统计信息
UpdateStatistics(tableName string, stats *TableStatistics)
}
CardinalityEstimator 基数估算器接口
type ColumnPruningRule ¶
type ColumnPruningRule struct{}
ColumnPruningRule 列裁剪规则 移除不需要的列
func (*ColumnPruningRule) Apply ¶
func (r *ColumnPruningRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*ColumnPruningRule) Match ¶
func (r *ColumnPruningRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type ColumnStatistics ¶
type ColumnStatistics struct {
Name string
DataType string
DistinctCount int64 // NDV (Number of Distinct Values)
NullCount int64
MinValue interface{}
MaxValue interface{}
NullFraction float64
AvgWidth float64 // 平均字符串长度
}
ColumnStatistics 列统计信息
type ConstantFoldingRule ¶
type ConstantFoldingRule struct{}
ConstantFoldingRule 常量折叠规则 计算常量表达式
func (*ConstantFoldingRule) Apply ¶
func (r *ConstantFoldingRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*ConstantFoldingRule) Match ¶
func (r *ConstantFoldingRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type CorrelatedColumn ¶
type CorrelatedColumn struct {
}
CorrelatedColumn represents a column that references outer query
func ExtractCorrelatedColumns ¶
func ExtractCorrelatedColumns(expr *parser.Expression, outerSchema []ColumnInfo) []CorrelatedColumn
ExtractCorrelatedColumns extracts correlated columns from an expression Returns columns that reference tables outside of current subquery scope
type CostModel ¶
type CostModel interface {
// ScanCost 计算扫描成本
ScanCost(tableName string, rowCount int64) float64
// FilterCost 计算过滤成本
FilterCost(inputRows int64, selectivity float64) float64
// JoinCost 计算连接成本
JoinCost(leftRows, rightRows int64, joinType JoinType) float64
// AggregateCost 计算聚合成本
AggregateCost(inputRows int64, groupByCols int) float64
// ProjectCost 计算投影成本
ProjectCost(inputRows int64, projCols int) float64
}
CostModel 成本模型
type DPJoinReorderAdapter ¶
type DPJoinReorderAdapter struct {
// contains filtered or unexported fields
}
DPJoinReorderAdapter DP JOIN重排序适配器
func (*DPJoinReorderAdapter) Apply ¶
func (a *DPJoinReorderAdapter) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
func (*DPJoinReorderAdapter) Match ¶
func (a *DPJoinReorderAdapter) Match(plan LogicalPlan) bool
func (*DPJoinReorderAdapter) Name ¶
func (a *DPJoinReorderAdapter) Name() string
type DecorrelateRule ¶
type DecorrelateRule struct {
// contains filtered or unexported fields
}
DecorrelateRule eliminates Apply nodes by converting them to JOIN operations Implements 8 strategies for different subquery patterns
func NewDecorrelateRule ¶
func NewDecorrelateRule(estimator CardinalityEstimator) *DecorrelateRule
NewDecorrelateRule creates a new decorrelation rule
func (*DecorrelateRule) Apply ¶
func (r *DecorrelateRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the decorrelation rule
func (*DecorrelateRule) Match ¶
func (r *DecorrelateRule) Match(plan LogicalPlan) bool
Match checks if the rule matches an Apply node
type DefaultCostModel ¶
DefaultCostModel 默认成本模型
func NewDefaultCostModel ¶
func NewDefaultCostModel() *DefaultCostModel
NewDefaultCostModel 创建默认成本模型
func (*DefaultCostModel) AggregateCost ¶
func (cm *DefaultCostModel) AggregateCost(inputRows int64, groupByCols int) float64
AggregateCost 计算聚合成本
func (*DefaultCostModel) FilterCost ¶
func (cm *DefaultCostModel) FilterCost(inputRows int64, selectivity float64) float64
FilterCost 计算过滤成本
func (*DefaultCostModel) JoinCost ¶
func (cm *DefaultCostModel) JoinCost(leftRows, rightRows int64, joinType JoinType) float64
JoinCost 计算连接成本
func (*DefaultCostModel) ProjectCost ¶
func (cm *DefaultCostModel) ProjectCost(inputRows int64, projCols int) float64
ProjectCost 计算投影成本
type DefaultShowProcessor ¶
type DefaultShowProcessor struct {
// contains filtered or unexported fields
}
DefaultShowProcessor 是 ShowProcessor 接口的默认实现
func NewDefaultShowProcessor ¶
func NewDefaultShowProcessor(dataSource domain.DataSource) *DefaultShowProcessor
NewDefaultShowProcessor 创建默认的 SHOW 处理器
func NewDefaultShowProcessorWithManager ¶
func NewDefaultShowProcessorWithManager(dataSource domain.DataSource, dsManager interface{}) *DefaultShowProcessor
NewDefaultShowProcessorWithManager 创建带有数据源管理器的 SHOW 处理器
func (*DefaultShowProcessor) ProcessShowColumns ¶
func (sp *DefaultShowProcessor) ProcessShowColumns(ctx context.Context, tableName string) (executor.ResultSet, error)
ProcessShowColumns 处理 SHOW COLUMNS 语句
func (*DefaultShowProcessor) ProcessShowCreateTable ¶
func (sp *DefaultShowProcessor) ProcessShowCreateTable(ctx context.Context, tableName string) (executor.ResultSet, error)
ProcessShowCreateTable 处理 SHOW CREATE TABLE 语句
func (*DefaultShowProcessor) ProcessShowDatabases ¶
func (sp *DefaultShowProcessor) ProcessShowDatabases(ctx context.Context) (executor.ResultSet, error)
ProcessShowDatabases 处理 SHOW DATABASES 语句
func (*DefaultShowProcessor) ProcessShowIndex ¶
func (sp *DefaultShowProcessor) ProcessShowIndex(ctx context.Context, tableName string) (executor.ResultSet, error)
ProcessShowIndex 处理 SHOW INDEX 语句
func (*DefaultShowProcessor) ProcessShowProcessList ¶
func (sp *DefaultShowProcessor) ProcessShowProcessList(ctx context.Context) (executor.ResultSet, error)
ProcessShowProcessList 处理 SHOW PROCESSLIST 语句
func (*DefaultShowProcessor) ProcessShowStatus ¶
ProcessShowStatus 处理 SHOW STATUS 语句
func (*DefaultShowProcessor) ProcessShowTables ¶
ProcessShowTables 处理 SHOW TABLES 语句
func (*DefaultShowProcessor) ProcessShowVariables ¶
func (sp *DefaultShowProcessor) ProcessShowVariables(ctx context.Context) (executor.ResultSet, error)
ProcessShowVariables 处理 SHOW VARIABLES 语句
func (*DefaultShowProcessor) SetCurrentDB ¶
func (sp *DefaultShowProcessor) SetCurrentDB(dbName string)
SetCurrentDB 设置当前数据库
func (*DefaultShowProcessor) SetProcessListProvider ¶
func (sp *DefaultShowProcessor) SetProcessListProvider(provider ProcessListProvider)
SetProcessListProvider 设置进程列表提供者
type DefaultVariableManager ¶
type DefaultVariableManager struct {
// contains filtered or unexported fields
}
DefaultVariableManager 是 VariableManager 接口的默认实现
func NewDefaultVariableManager ¶
func NewDefaultVariableManager() *DefaultVariableManager
NewDefaultVariableManager 创建默认的变量管理器
func (*DefaultVariableManager) EvaluateSystemVariable ¶
func (vm *DefaultVariableManager) EvaluateSystemVariable(varName string) (interface{}, error)
EvaluateSystemVariable 评估系统变量(用于表达式求值)
func (*DefaultVariableManager) GetVariable ¶
func (vm *DefaultVariableManager) GetVariable(name string) (interface{}, bool)
GetVariable 获取变量的值
func (*DefaultVariableManager) GetVariableNames ¶
func (vm *DefaultVariableManager) GetVariableNames() []string
GetVariableNames 返回所有变量名
func (*DefaultVariableManager) ListVariables ¶
func (vm *DefaultVariableManager) ListVariables() map[string]interface{}
ListVariables 返回所有变量
func (*DefaultVariableManager) SetVariable ¶
func (vm *DefaultVariableManager) SetVariable(name string, value interface{}) error
SetVariable 设置变量的值
type DeltaBuffer ¶
type DeltaBuffer struct {
TableName string
InsertCount int64
UpdateCount int64
DeleteCount int64
ModifiedRows map[string]int64 // 列名 -> 修改的行数
LastUpdated time.Time
BufferSize int64 // 总变化量
}
DeltaBuffer Delta缓冲区 记录自上次统计收集以来的变化
type DeriveTopNFromWindowRule ¶
type DeriveTopNFromWindowRule struct{}
DeriveTopNFromWindowRule derives TopN from window functions Pattern: ROW_NUMBER() OVER (ORDER BY ...) LIMIT N -> TopN
func NewDeriveTopNFromWindowRule ¶
func NewDeriveTopNFromWindowRule() *DeriveTopNFromWindowRule
NewDeriveTopNFromWindowRule creates a new rule
func (*DeriveTopNFromWindowRule) Apply ¶
func (r *DeriveTopNFromWindowRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply converts window function to TopN
func (*DeriveTopNFromWindowRule) Match ¶
func (r *DeriveTopNFromWindowRule) Match(plan LogicalPlan) bool
Match checks if the plan has a window function that can be converted to TopN
func (*DeriveTopNFromWindowRule) Name ¶
func (r *DeriveTopNFromWindowRule) Name() string
Name returns the rule name
type EnhancedCardinalityEstimator ¶
type EnhancedCardinalityEstimator struct {
// contains filtered or unexported fields
}
EnhancedCardinalityEstimator 增强的基数估算器 使用更精确的统计信息和算法进行估算
func NewEnhancedCardinalityEstimator ¶
func NewEnhancedCardinalityEstimator(baseEstimator CardinalityEstimator) *EnhancedCardinalityEstimator
NewEnhancedCardinalityEstimator 创建增强基数估算器
func (*EnhancedCardinalityEstimator) EstimateDistinct ¶
func (e *EnhancedCardinalityEstimator) EstimateDistinct(table string, columns []string) int64
EstimateDistinct 估算DISTINCT后的行数(使用增强统计)
func (*EnhancedCardinalityEstimator) EstimateFilter ¶
func (e *EnhancedCardinalityEstimator) EstimateFilter(table string, filters []domain.Filter) int64
EstimateFilter 使用直方图和相关性精确估算过滤后的基数
func (*EnhancedCardinalityEstimator) EstimateJoin ¶
func (e *EnhancedCardinalityEstimator) EstimateJoin(left, right LogicalPlan, joinType JoinType) int64
EstimateJoin 使用增强算法估算JOIN基数
func (*EnhancedCardinalityEstimator) EstimateTableScan ¶
func (e *EnhancedCardinalityEstimator) EstimateTableScan(tableName string) int64
EstimateTableScan 估算表扫描基数(使用直方图)
func (*EnhancedCardinalityEstimator) Explain ¶
func (e *EnhancedCardinalityEstimator) Explain() string
Explain 解释增强基数估算器
func (*EnhancedCardinalityEstimator) UpdateStatistics ¶
func (e *EnhancedCardinalityEstimator) UpdateStatistics(tableName string, stats *TableStatistics)
UpdateStatistics 更新增强统计信息
type EnhancedColumnPruningRule ¶
type EnhancedColumnPruningRule struct {
// contains filtered or unexported fields
}
EnhancedColumnPruningRule enhances column pruning with cross-operator analysis Propagates required columns from top to bottom through the plan
func NewEnhancedColumnPruningRule ¶
func NewEnhancedColumnPruningRule() *EnhancedColumnPruningRule
NewEnhancedColumnPruningRule creates a new enhanced column pruning rule
func (*EnhancedColumnPruningRule) Apply ¶
func (r *EnhancedColumnPruningRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the enhanced column pruning rule
func (*EnhancedColumnPruningRule) Match ¶
func (r *EnhancedColumnPruningRule) Match(plan LogicalPlan) bool
Match always returns true for cross-operator analysis
func (*EnhancedColumnPruningRule) Name ¶
func (r *EnhancedColumnPruningRule) Name() string
Name returns rule name
type EnhancedLogicalSort ¶
type EnhancedLogicalSort struct {
*LogicalSort
ForceIndex string // 强制使用的索引
DisableIndex bool // 禁止使用索引排序
SortMethod string // 排序方法(INDEX_SORT, EXTERNAL_SORT, QUICK_SORT)
MemoryLimit int64 // 内存限制(字节)
}
EnhancedLogicalSort 增强的LogicalSort(支持hints)
func ApplyOrderByHintsToPhysicalPlan ¶
func ApplyOrderByHintsToPhysicalPlan(plan *LogicalSort, hints *OptimizerHints, optCtx *OptimizationContext) *EnhancedLogicalSort
ApplyOrderByHintsToPhysicalPlan 将ORDER BY hints应用到物理计划
type EnhancedOptimizer ¶
type EnhancedOptimizer struct {
// contains filtered or unexported fields
}
EnhancedOptimizer 增强的优化器 集成所有新的优化模块,使用接口实现依赖注入
func NewEnhancedOptimizer ¶
func NewEnhancedOptimizer(dataSource domain.DataSource, parallelism int) *EnhancedOptimizer
NewEnhancedOptimizer 创建增强的优化器
func (*EnhancedOptimizer) GetParallelism ¶
func (eo *EnhancedOptimizer) GetParallelism() int
GetParallelism 获取并行度
func (*EnhancedOptimizer) GetStatisticsCache ¶
func (eo *EnhancedOptimizer) GetStatisticsCache() *statistics.AutoRefreshStatisticsCache
GetStatisticsCache 获取统计信息缓存
func (*EnhancedOptimizer) Optimize ¶
func (eo *EnhancedOptimizer) Optimize(ctx context.Context, stmt *parser.SQLStatement) (*plan.Plan, error)
Optimize 优化查询(增强版)
func (*EnhancedOptimizer) SetParallelism ¶
func (eo *EnhancedOptimizer) SetParallelism(parallelism int)
SetParallelism 设置并行度
type EnhancedPredicatePushdownRule ¶
type EnhancedPredicatePushdownRule struct {
// contains filtered or unexported fields
}
EnhancedPredicatePushdownRule 增强的谓词下推规则 支持跨JOIN谓词下推、OR条件处理
func NewEnhancedPredicatePushdownRule ¶
func NewEnhancedPredicatePushdownRule(estimator CardinalityEstimator) *EnhancedPredicatePushdownRule
NewEnhancedPredicatePushdownRule 创建增强谓词下推规则
func (*EnhancedPredicatePushdownRule) Apply ¶
func (r *EnhancedPredicatePushdownRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*EnhancedPredicatePushdownRule) Explain ¶
func (r *EnhancedPredicatePushdownRule) Explain(result LogicalPlan) string
Explain 解释规则应用
func (*EnhancedPredicatePushdownRule) Match ¶
func (r *EnhancedPredicatePushdownRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
func (*EnhancedPredicatePushdownRule) Name ¶
func (r *EnhancedPredicatePushdownRule) Name() string
Name 返回规则名称
type EnhancedTableStatistics ¶
type EnhancedTableStatistics struct {
Base *TableStatistics
Histograms map[string]*Histogram // 列直方图
Correlations map[string]float64 // 列相关性
CV float64 // 基数变异系数 (Cardinality Variability)
Skewness float64 // 数据偏度
}
EnhancedTableStatistics 增强的表统计信息
type ExpressionEvaluator ¶
type ExpressionEvaluator struct {
// contains filtered or unexported fields
}
ExpressionEvaluator 表达式求值器
func NewExpressionEvaluator ¶
func NewExpressionEvaluator(fnAPI *builtin.FunctionAPI) *ExpressionEvaluator
NewExpressionEvaluator 创建表达式求值器
func NewExpressionEvaluatorWithoutAPI ¶
func NewExpressionEvaluatorWithoutAPI() *ExpressionEvaluator
NewExpressionEvaluatorWithoutAPI 创建不依赖函数API的表达式求值器 用于不需要调用函数的场景(如常量折叠)
func (*ExpressionEvaluator) Evaluate ¶
func (e *ExpressionEvaluator) Evaluate(expr interface{}, ctx executor.ExpressionContext) (interface{}, error)
Evaluate 实现 executor.ExpressionEvaluator 接口
func (*ExpressionEvaluator) EvaluateBoolean ¶
func (e *ExpressionEvaluator) EvaluateBoolean(expr interface{}, ctx executor.ExpressionContext) (bool, error)
EvaluateBoolean 评估表达式并返回布尔值(实现 executor.ExpressionEvaluator 接口)
func (*ExpressionEvaluator) Validate ¶
func (e *ExpressionEvaluator) Validate(expr interface{}) error
Validate 验证表达式(实现 executor.ExpressionEvaluator 接口)
type ExpressionExecutor ¶
type ExpressionExecutor struct {
// contains filtered or unexported fields
}
ExpressionExecutor 表达式执行器 负责处理无 FROM 子句查询中的表达式求值
func NewExpressionExecutor ¶
func NewExpressionExecutor(currentDB string, functionAPI interface{}, exprEvaluator *ExpressionEvaluator) *ExpressionExecutor
NewExpressionExecutor 创建表达式执行器
func (*ExpressionExecutor) HandleNoFromQuery ¶
func (e *ExpressionExecutor) HandleNoFromQuery(stmt *parser.SelectStatement) (*Result, error)
HandleNoFromQuery 处理没有 FROM 子句的查询(如 SELECT DATABASE(), SELECT NOW())
func (*ExpressionExecutor) SetCurrentDB ¶
func (e *ExpressionExecutor) SetCurrentDB(dbName string)
SetCurrentDB 设置当前数据库
type FullTextIndexCandidate ¶
type FullTextIndexCandidate struct {
TableName string
Columns []string // 支持的列类型:TEXT, VARCHAR
MinLength int // 最小词长度(默认 4)
StopWords []string // 停用词列表
}
FullTextIndexCandidate 全文索引候选
type FullTextIndexSupport ¶
FullTextIndexSupport 全文索引支持
func NewFullTextIndexSupport ¶
func NewFullTextIndexSupport() *FullTextIndexSupport
NewFullTextIndexSupport 创建全文索引支持实例
func (*FullTextIndexSupport) CalculateFullTextSearchBenefit ¶
func (fts *FullTextIndexSupport) CalculateFullTextSearchBenefit( rowCount int64, searchTermLength int, exactMatch bool, ) float64
CalculateFullTextSearchBenefit 计算全文索引的搜索收益
func (*FullTextIndexSupport) EstimateFullTextIndexStats ¶
func (fts *FullTextIndexSupport) EstimateFullTextIndexStats( tableName string, columns []string, rowCount int64, ) *HypotheticalIndexStats
EstimateFullTextIndexStats 估算全文索引统计信息
func (*FullTextIndexSupport) ExtractFullTextIndexCandidates ¶
func (fts *FullTextIndexSupport) ExtractFullTextIndexCandidates( tableName string, expression string, columnTypes map[string]string, ) []*IndexCandidate
ExtractFullTextIndexCandidates 从表达式中提取全文索引候选
func (*FullTextIndexSupport) GetFullTextIndexDDL ¶
func (fts *FullTextIndexSupport) GetFullTextIndexDDL( tableName string, columns []string, indexName string, ) string
GetFullTextIndexDDL 生成创建全文索引的 DDL
func (*FullTextIndexSupport) IsColumnTypeCompatible ¶
func (fts *FullTextIndexSupport) IsColumnTypeCompatible(columnType string) bool
IsColumnTypeCompatible 检查列类型是否支持全文索引
func (*FullTextIndexSupport) IsFullTextExpression ¶
func (fts *FullTextIndexSupport) IsFullTextExpression(expr string) bool
IsFullTextExpression 检查表达式是否为全文索引相关表达式
func (*FullTextIndexSupport) IsStopWord ¶
func (fts *FullTextIndexSupport) IsStopWord(word string) bool
IsStopWord 检查是否为停用词
func (*FullTextIndexSupport) OptimizeFullTextQuery ¶
func (fts *FullTextIndexSupport) OptimizeFullTextQuery( query string, tables map[string]bool, ) []string
OptimizeFullTextQuery 优化全文查询建议
func (*FullTextIndexSupport) TokenizeText ¶
func (fts *FullTextIndexSupport) TokenizeText(text string) []string
TokenizeText 文本分词
type GeneticAlgorithm ¶
type GeneticAlgorithm = genetic.GeneticAlgorithm
GeneticAlgorithm 遗传算法,用于搜索最优索引组合 Deprecated: 已迁移到 pkg/optimizer/genetic 包,此类型仅为兼容性保留
type GeneticAlgorithmConfig ¶
type GeneticAlgorithmConfig = genetic.GeneticAlgorithmConfig
GeneticAlgorithmConfig 遗传算法配置 Deprecated: 已迁移到 pkg/optimizer/genetic 包,此类型仅为兼容性保留
type HintAwareAggRule ¶
type HintAwareAggRule struct{}
HintAwareAggRule 支持 hints 的聚合规则
func NewHintAwareAggRule ¶
func NewHintAwareAggRule() *HintAwareAggRule
NewHintAwareAggRule 创建 hint 感知的聚合规则
func (*HintAwareAggRule) Apply ¶
func (r *HintAwareAggRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*HintAwareAggRule) ApplyWithHints ¶
func (r *HintAwareAggRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
ApplyWithHints 应用带有 hints 的规则
func (*HintAwareAggRule) Match ¶
func (r *HintAwareAggRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type HintAwareIndexRule ¶
type HintAwareIndexRule struct{}
HintAwareIndexRule 支持 hints 的索引使用规则
func NewHintAwareIndexRule ¶
func NewHintAwareIndexRule() *HintAwareIndexRule
NewHintAwareIndexRule 创建 hint 感知的索引规则
func (*HintAwareIndexRule) Apply ¶
func (r *HintAwareIndexRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*HintAwareIndexRule) ApplyWithHints ¶
func (r *HintAwareIndexRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
ApplyWithHints 应用带有 hints 的规则
func (*HintAwareIndexRule) Match ¶
func (r *HintAwareIndexRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type HintAwareJoinReorderRule ¶
type HintAwareJoinReorderRule struct {
// contains filtered or unexported fields
}
HintAwareJoinReorderRule 支持 hints 的 JOIN 重排序规则
func NewHintAwareJoinReorderRule ¶
func NewHintAwareJoinReorderRule() *HintAwareJoinReorderRule
NewHintAwareJoinReorderRule 创建 hint 感知的 JOIN 重排序规则
func (*HintAwareJoinReorderRule) Apply ¶
func (r *HintAwareJoinReorderRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*HintAwareJoinReorderRule) ApplyWithHints ¶
func (r *HintAwareJoinReorderRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
ApplyWithHints 应用带有 hints 的规则
func (*HintAwareJoinReorderRule) Match ¶
func (r *HintAwareJoinReorderRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
func (*HintAwareJoinReorderRule) Name ¶
func (r *HintAwareJoinReorderRule) Name() string
Name 返回规则名称
type HintAwareJoinTypeHintRule ¶
type HintAwareJoinTypeHintRule struct {
}
HintAwareJoinTypeHintRule 专门处理连接类型 hint 的规则
func NewHintAwareJoinTypeHintRule ¶
func NewHintAwareJoinTypeHintRule() *HintAwareJoinTypeHintRule
NewHintAwareJoinTypeHintRule 创建连接类型 hint 规则
func (*HintAwareJoinTypeHintRule) Apply ¶
func (r *HintAwareJoinTypeHintRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*HintAwareJoinTypeHintRule) ApplyWithHints ¶
func (r *HintAwareJoinTypeHintRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
ApplyWithHints 应用带有 hints 的规则
func (*HintAwareJoinTypeHintRule) Match ¶
func (r *HintAwareJoinTypeHintRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
func (*HintAwareJoinTypeHintRule) Name ¶
func (r *HintAwareJoinTypeHintRule) Name() string
Name 返回规则名称
type HintAwareRule ¶
type HintAwareRule interface {
OptimizationRule
// ApplyWithHints 应用带有 hints 的规则
ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
}
HintAwareRule 支持 hints 的优化规则接口
type HintAwareSubqueryRule ¶
type HintAwareSubqueryRule struct {
// contains filtered or unexported fields
}
HintAwareSubqueryRule 支持 hints 的子查询规则
func NewHintAwareSubqueryRule ¶
func NewHintAwareSubqueryRule(estimator CardinalityEstimator) *HintAwareSubqueryRule
NewHintAwareSubqueryRule 创建 hint 感知的子查询规则
func (*HintAwareSubqueryRule) Apply ¶
func (r *HintAwareSubqueryRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*HintAwareSubqueryRule) ApplyWithHints ¶
func (r *HintAwareSubqueryRule) ApplyWithHints(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext, hints *OptimizerHints) (LogicalPlan, error)
ApplyWithHints 应用带有 hints 的规则
func (*HintAwareSubqueryRule) Match ¶
func (r *HintAwareSubqueryRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type Histogram ¶
type Histogram struct {
ColumnName string
Buckets []*HistogramBucket // 直方图桶
BucketCount int // 桶数量
IsEquiDepth bool // 是否等深直方图
TotalNDV int64 // 总的不同值数
SampleCount int64 // 样本数
NullCount int64 // NULL值数
}
Histogram 直方图(等宽或等高)
type HistogramBucket ¶
type HistogramBucket struct {
LowerBound interface{} // 下界(包含)
UpperBound interface{} // 上界(不包含)
RowCount int64 // 行数
DistinctCount int64 // 桶内不同值数
RepeatCount int64 // 重复值计数
}
HistogramBucket 直方图桶
type HypotheticalIndex ¶
type HypotheticalIndex struct {
ID string
TableName string
Columns []string
IsUnique bool
IsPrimary bool
Stats *HypotheticalIndexStats
CreatedAt time.Time
}
HypotheticalIndex 虚拟索引
type HypotheticalIndexDisplay ¶
type HypotheticalIndexDisplay struct {
ID string
TableName string
IndexColumns []string
IsUnique bool
Selectivity float64
EstimatedSize int64
CreatedAt time.Time
}
HypotheticalIndexDisplay 虚拟索引显示信息
type HypotheticalIndexStats ¶
type HypotheticalIndexStats struct {
NDV int64 // Number of Distinct Values
Selectivity float64 // 选择性(0-1)
EstimatedSize int64 // 预估索引大小(字节)
NullFraction float64 // NULL 值比例
Correlation float64 // 列相关性因子
}
HypotheticalIndexStats 虚拟索引统计信息
type HypotheticalIndexStore ¶
type HypotheticalIndexStore struct {
// contains filtered or unexported fields
}
HypotheticalIndexStore 虚拟索引存储 内存存储,不持久化,用于 What-If 分析
func NewHypotheticalIndexStore ¶
func NewHypotheticalIndexStore() *HypotheticalIndexStore
NewHypotheticalIndexStore 创建虚拟索引存储
func (*HypotheticalIndexStore) CreateIndex ¶
func (s *HypotheticalIndexStore) CreateIndex(tableName string, columns []string, isUnique, isPrimary bool) (*HypotheticalIndex, error)
CreateIndex 创建虚拟索引
func (*HypotheticalIndexStore) DeleteIndex ¶
func (s *HypotheticalIndexStore) DeleteIndex(indexID string) error
DeleteIndex 删除虚拟索引
func (*HypotheticalIndexStore) DeleteTableIndexes ¶
func (s *HypotheticalIndexStore) DeleteTableIndexes(tableName string) int
DeleteTableIndexes 删除表的所有虚拟索引
func (*HypotheticalIndexStore) FindIndexByColumns ¶
func (s *HypotheticalIndexStore) FindIndexByColumns(tableName string, columns []string) (*HypotheticalIndex, bool)
FindIndexByColumns 根据列查找索引
func (*HypotheticalIndexStore) GetIndex ¶
func (s *HypotheticalIndexStore) GetIndex(indexID string) (*HypotheticalIndex, bool)
GetIndex 获取虚拟索引
func (*HypotheticalIndexStore) GetTableIndexes ¶
func (s *HypotheticalIndexStore) GetTableIndexes(tableName string) []*HypotheticalIndex
GetTableIndexes 获取表的所有虚拟索引
func (*HypotheticalIndexStore) ListAllIndexes ¶
func (s *HypotheticalIndexStore) ListAllIndexes() []*HypotheticalIndex
ListAllIndexes 列出所有索引
func (*HypotheticalIndexStore) UpdateStats ¶
func (s *HypotheticalIndexStore) UpdateStats(indexID string, stats *HypotheticalIndexStats) error
UpdateStats 更新索引统计信息
type HypotheticalStatsGenerator ¶
type HypotheticalStatsGenerator struct {
// contains filtered or unexported fields
}
HypotheticalStatsGenerator 虚拟索引统计信息生成器 基于表统计信息生成虚拟索引的统计信息
func NewHypotheticalStatsGenerator ¶
func NewHypotheticalStatsGenerator(estimator statistics.CardinalityEstimator) *HypotheticalStatsGenerator
NewHypotheticalStatsGenerator 创建虚拟索引统计生成器
func (*HypotheticalStatsGenerator) CompareWithFullScan ¶
func (g *HypotheticalStatsGenerator) CompareWithFullScan(indexStats *HypotheticalIndexStats, rowCount int64) (float64, bool)
CompareWithFullScan 比较索引扫描与全表扫描
func (*HypotheticalStatsGenerator) EstimateIndexJoinCost ¶
func (g *HypotheticalStatsGenerator) EstimateIndexJoinCost(leftStats, rightStats *HypotheticalIndexStats, leftRows, rightRows int64) float64
EstimateIndexJoinCost 估算使用索引的 JOIN 成本
func (*HypotheticalStatsGenerator) EstimateIndexScanCost ¶
func (g *HypotheticalStatsGenerator) EstimateIndexScanCost(stats *HypotheticalIndexStats, rowCount int64) float64
EstimateIndexScanCost 估算索引扫描成本
func (*HypotheticalStatsGenerator) GenerateStats ¶
func (g *HypotheticalStatsGenerator) GenerateStats(tableName string, columns []string, isUnique bool) (*HypotheticalIndexStats, error)
GenerateStats 为虚拟索引生成统计信息
func (*HypotheticalStatsGenerator) GetColumnStatistics ¶
func (g *HypotheticalStatsGenerator) GetColumnStatistics(tableName, columnName string) (*statistics.ColumnStatistics, error)
GetColumnStatistics 获取列统计信息(用于调试)
func (*HypotheticalStatsGenerator) UpdateTableInfo ¶
func (g *HypotheticalStatsGenerator) UpdateTableInfo(tableName string, info *domain.TableInfo)
UpdateTableInfo 更新表信息
type IncrementalStatisticsCollector ¶
type IncrementalStatisticsCollector struct {
// contains filtered or unexported fields
}
IncrementalStatisticsCollector 增量统计收集器 支持增量更新表统计信息,避免全表扫描
func NewIncrementalStatisticsCollector ¶
func NewIncrementalStatisticsCollector(baseCollector StatisticsCollector, bufferThreshold int64) *IncrementalStatisticsCollector
NewIncrementalStatisticsCollector 创建增量统计收集器
func (*IncrementalStatisticsCollector) CollectStatistics ¶
func (isc *IncrementalStatisticsCollector) CollectStatistics(ctx context.Context, tableName string) (*TableStatistics, error)
CollectStatistics 收集统计信息(增量或全量)
func (*IncrementalStatisticsCollector) EstimateStatisticsAccuracy ¶
func (isc *IncrementalStatisticsCollector) EstimateStatisticsAccuracy(tableName string) float64
EstimateStatisticsAccuracy 估算统计信息准确度
func (*IncrementalStatisticsCollector) FlushAllBuffers ¶
func (isc *IncrementalStatisticsCollector) FlushAllBuffers(ctx context.Context) error
FlushAllBuffers 刷新所有Delta缓冲区
func (*IncrementalStatisticsCollector) GetDeltaBufferSize ¶
func (isc *IncrementalStatisticsCollector) GetDeltaBufferSize(tableName string) int64
GetDeltaBufferSize 获取Delta缓冲区大小
func (*IncrementalStatisticsCollector) RecordDelete ¶
func (isc *IncrementalStatisticsCollector) RecordDelete(tableName string, rowCount int64)
RecordDelete 记录删除操作
func (*IncrementalStatisticsCollector) RecordInsert ¶
func (isc *IncrementalStatisticsCollector) RecordInsert(tableName string, rowCount int64)
RecordInsert 记录插入操作
func (*IncrementalStatisticsCollector) RecordUpdate ¶
func (isc *IncrementalStatisticsCollector) RecordUpdate(tableName string, rowCount int64, modifiedColumns []string)
RecordUpdate 记录更新操作
func (*IncrementalStatisticsCollector) ShouldCollect ¶
func (isc *IncrementalStatisticsCollector) ShouldCollect(tableName string) bool
ShouldCollect 判断是否需要收集统计信息
type Index ¶
type Index struct {
Name string
TableName string
Columns []string
Unique bool
Primary bool
Cardinality int64 // 基数(唯一值数量)
}
Index 索引定义
type IndexAdvisor ¶
type IndexAdvisor struct {
// 配置参数
MaxNumIndexes int
MaxIndexColumns int
MaxNumQuery int
Timeout time.Duration
// 遗传算法参数
PopulationSize int
MaxGenerations int
MutationRate float64
CrossoverRate float64
// contains filtered or unexported fields
}
IndexAdvisor 索引推荐器
func (*IndexAdvisor) GetHypotheticalIndexStore ¶
func (ia *IndexAdvisor) GetHypotheticalIndexStore() *HypotheticalIndexStore
GetHypotheticalIndexStore 获取虚拟索引存储
func (*IndexAdvisor) GetMergeStatements ¶
func (ia *IndexAdvisor) GetMergeStatements(merges []*IndexMerge) []string
GetMergeStatements 获取合并索引的 SQL 语句
func (*IndexAdvisor) RecommendForSingleQuery ¶
func (ia *IndexAdvisor) RecommendForSingleQuery( ctx context.Context, query string, tableInfo map[string]*domain.TableInfo, ) ([]*IndexRecommendation, error)
RecommendForSingleQuery 为单个查询推荐索引
func (*IndexAdvisor) RecommendForWorkload ¶
func (ia *IndexAdvisor) RecommendForWorkload( ctx context.Context, queries []string, tableInfo map[string]*domain.TableInfo, ) ([]*IndexRecommendation, error)
RecommendForWorkload 为工作负载推荐索引
func (*IndexAdvisor) RecommendMergedIndexes ¶
func (ia *IndexAdvisor) RecommendMergedIndexes( existingIndexes []*Index, candidates []*IndexCandidate, ) ([]*IndexMerge, error)
RecommendMergedIndexes 推荐可合并的索引
func (*IndexAdvisor) Run ¶
func (ia *IndexAdvisor) Run( ctx context.Context, query string, tableInfo map[string]*domain.TableInfo, ) ([]*IndexRecommendation, error)
Run 主入口
func (*IndexAdvisor) SetIndexMerger ¶
func (ia *IndexAdvisor) SetIndexMerger(merger *IndexMerger)
SetIndexMerger 设置索引合并器
func (*IndexAdvisor) SetStatisticsIntegrator ¶
func (ia *IndexAdvisor) SetStatisticsIntegrator(integrator *StatisticsIntegrator)
SetStatisticsIntegrator 设置统计信息集成器
type IndexAdvisorResult ¶
type IndexAdvisorResult struct {
ID string
Database string
TableName string
IndexName string
IndexColumns []string
EstIndexSize int64
Reason string
CreateStatement string
EstimatedBenefit float64
Timestamp time.Time
}
IndexAdvisorResult 索引推荐结果
type IndexCandidate ¶
type IndexCandidate struct {
TableName string
Columns []string
Priority int // 优先级(WHERE=4, JOIN=3, GROUP=2, ORDER=1)
Source string // 来源(WHERE, JOIN, GROUP, ORDER)
Unique bool // 是否唯一索引
IndexType string // 索引类型:BTREE, FULLTEXT, SPATIAL
}
IndexCandidate 索引候选
func ConvertGeneticResults ¶
func ConvertGeneticResults(results []*genetic.IndexCandidate) []*IndexCandidate
ConvertGeneticResults 转换遗传算法结果类型
type IndexCandidateExtractor ¶
type IndexCandidateExtractor struct {
// contains filtered or unexported fields
}
IndexCandidateExtractor 索引候选提取器 从 SQL 语句中提取可索引的列,作为索引推荐的候选
func NewIndexCandidateExtractor ¶
func NewIndexCandidateExtractor() *IndexCandidateExtractor
NewIndexCandidateExtractor 创建索引候选提取器
func (*IndexCandidateExtractor) ExtractForTable ¶
func (e *IndexCandidateExtractor) ExtractForTable(candidates []*IndexCandidate, tableName string) []*IndexCandidate
ExtractForTable 提取指定表的索引候选
func (*IndexCandidateExtractor) ExtractFromSQL ¶
func (e *IndexCandidateExtractor) ExtractFromSQL(stmt *parser.SQLStatement, tableInfo map[string]*domain.TableInfo) ([]*IndexCandidate, error)
ExtractFromSQL 从 SQL 语句提取索引候选
func (*IndexCandidateExtractor) FilterByColumnType ¶
func (e *IndexCandidateExtractor) FilterByColumnType(candidates []*IndexCandidate, tableInfo map[string]*domain.TableInfo) []*IndexCandidate
FilterByColumnType 根据列类型过滤候选
func (*IndexCandidateExtractor) GetColumnInfo ¶
func (e *IndexCandidateExtractor) GetColumnInfo(tableInfo map[string]*domain.TableInfo, tableName, columnName string) (string, bool)
GetColumnInfo 获取列信息
func (*IndexCandidateExtractor) MergeCandidates ¶
func (e *IndexCandidateExtractor) MergeCandidates(candidates []*IndexCandidate) []*IndexCandidate
MergeCandidates 合并相似的候选
type IndexCostEstimator ¶
type IndexCostEstimator struct {
// contains filtered or unexported fields
}
IndexCostEstimator 索引成本估算器 用于更精确地估算索引扫描和查找的成本
func NewIndexCostEstimator ¶
func NewIndexCostEstimator() *IndexCostEstimator
NewIndexCostEstimator 创建索引成本估算器
func (*IndexCostEstimator) AdjustCostForSkew ¶
func (ice *IndexCostEstimator) AdjustCostForSkew( cost float64, skewFactor float64, ) float64
AdjustCostForSkew 考虑数据偏斜调整成本
func (*IndexCostEstimator) EstimateAggregateCost ¶
func (ice *IndexCostEstimator) EstimateAggregateCost( rowCount int64, groupByColumns []string, indexStats *HypotheticalIndexStats, indexColumns []string, ) float64
EstimateAggregateCost 估算聚合成本
func (*IndexCostEstimator) EstimateBenefit ¶
func (ice *IndexCostEstimator) EstimateBenefit( baseCost float64, indexCost float64, ) float64
EstimateBenefit 估算索引收益
func (*IndexCostEstimator) EstimateCardinality ¶
func (ice *IndexCostEstimator) EstimateCardinality( ndv float64, selectivity float64, rowCount int64, ) int64
EstimateCardinality 估算结果基数
func (*IndexCostEstimator) EstimateIndexLookupCost ¶
func (ice *IndexCostEstimator) EstimateIndexLookupCost( indexStats *HypotheticalIndexStats, rowCount int64, ) float64
EstimateIndexLookupCost 估算索引查找成本(等值查找)
func (*IndexCostEstimator) EstimateIndexRangeScanCost ¶
func (ice *IndexCostEstimator) EstimateIndexRangeScanCost( indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64, ) float64
EstimateIndexRangeScanCost 估算索引范围扫描成本
func (*IndexCostEstimator) EstimateIndexScanCost ¶
func (ice *IndexCostEstimator) EstimateIndexScanCost( indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64, ) float64
EstimateIndexScanCost 估算索引扫描成本
func (*IndexCostEstimator) EstimateJoinCost ¶
func (ice *IndexCostEstimator) EstimateJoinCost( outerRowCount int64, innerRowCount int64, innerIndexStats *HypotheticalIndexStats, joinSelectivity float64, ) float64
EstimateJoinCost 估算连接成本(基于索引)
func (*IndexCostEstimator) EstimateMultiColumnIndexCost ¶
func (ice *IndexCostEstimator) EstimateMultiColumnIndexCost( indexStats *HypotheticalIndexStats, rowCount int64, selectivity float64, leadingColumnSelectivity []float64, ) float64
EstimateMultiColumnIndexCost 估算多列索引的成本
func (*IndexCostEstimator) EstimateRangeSelectivity ¶
func (ice *IndexCostEstimator) EstimateRangeSelectivity( ndv float64, rowCount int64, condition *parser.Expression, ) float64
EstimateRangeSelectivity 估算范围条件的选择性
func (*IndexCostEstimator) EstimateSelectivityFromNDV ¶
func (ice *IndexCostEstimator) EstimateSelectivityFromNDV(ndv float64, rowCount int64) float64
EstimateSelectivityFromNDV 根据NDV估算选择性
type IndexManager ¶
type IndexManager struct {
// contains filtered or unexported fields
}
IndexManager 索引管理器
func (*IndexManager) FindBestIndex ¶
func (im *IndexManager) FindBestIndex(tableName string, columns []string) *Index
FindBestIndex 查找最佳索引
func (*IndexManager) GetIndexStats ¶
func (im *IndexManager) GetIndexStats(indexName string) *IndexStats
GetIndexStats 获取索引统计
func (*IndexManager) GetIndices ¶
func (im *IndexManager) GetIndices(tableName string) []*Index
GetIndices 获取表的所有索引
func (*IndexManager) RecordIndexAccess ¶
func (im *IndexManager) RecordIndexAccess(indexName string, duration time.Duration)
RecordIndexAccess 记录索引访问
type IndexMerge ¶
type IndexMerge struct {
SourceIndexes []string // 被合并的索引名称
MergedIndex *MergerIndex // 合并后的索引
Benefit float64 // 收益(成本降低比例)
Reduction int // 减少的索引数量
SpaceSaved int64 // 节省的空间(字节)
Reason string // 合并原因
}
IndexMerge 索引合并结果
type IndexMerger ¶
type IndexMerger struct {
// contains filtered or unexported fields
}
IndexMerger 索引合并器 用于识别和合并可以合并的索引
func (*IndexMerger) CalculateMergeBenefit ¶
func (im *IndexMerger) CalculateMergeBenefit(before []*MergerIndex, after []*MergerIndex) float64
CalculateMergeBenefit 计算合并收益
func (*IndexMerger) CalculateSpaceSavings ¶
func (im *IndexMerger) CalculateSpaceSavings(merges []IndexMerge) int64
CalculateSpaceSavings 计算空间节省
func (*IndexMerger) ExplainMerge ¶
func (im *IndexMerger) ExplainMerge(merge IndexMerge) string
ExplainMerge 解释合并操作
func (*IndexMerger) FindMergeableIndexes ¶
func (im *IndexMerger) FindMergeableIndexes(existingIndexes []*Index, candidates []*IndexCandidate) []IndexMerge
FindMergeableIndexes 查找可以合并的索引
func (*IndexMerger) GenerateMergeStatements ¶
func (im *IndexMerger) GenerateMergeStatements(merges []IndexMerge) []string
GenerateMergeStatements 生成合并索引的 SQL 语句
func (*IndexMerger) GetRecommendedMerges ¶
func (im *IndexMerger) GetRecommendedMerges(existingIndexes []*Index, candidates []*IndexCandidate) []*IndexMerge
GetRecommendedMerges 获取推荐的合并操作
func (*IndexMerger) MergeIndexes ¶
func (im *IndexMerger) MergeIndexes(indexes []*MergerIndex) *MergerIndex
MergeIndexes 合并多个索引为一个索引
type IndexRecommendation ¶
type IndexRecommendation struct {
TableName string
Columns []string
EstimatedBenefit float64 // 收益(0-1)
EstimatedCost float64 // 成本降低百分比
Reason string
CreateStatement string
RecommendationID string
}
IndexRecommendation 索引推荐
type IndexSelectionAdapter ¶
type IndexSelectionAdapter struct {
// contains filtered or unexported fields
}
IndexSelectionAdapter 索引选择适配器
func (*IndexSelectionAdapter) Apply ¶
func (a *IndexSelectionAdapter) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
func (*IndexSelectionAdapter) Match ¶
func (a *IndexSelectionAdapter) Match(plan LogicalPlan) bool
func (*IndexSelectionAdapter) Name ¶
func (a *IndexSelectionAdapter) Name() string
type IndexSelector ¶
type IndexSelector interface {
SelectBestIndex(tableName string, filters []domain.Filter, requiredCols []string) *index.IndexSelection
}
IndexSelector is the interface for index selection
type IndexStats ¶
type IndexStats struct {
Name string
HitCount int64
MissCount int64
AvgAccessTime time.Duration
LastAccessed time.Time
}
IndexStats 索引统计信息
type JoinCondition ¶
type JoinCondition struct {
Left *parser.Expression
Right *parser.Expression
Operator string
}
JoinCondition 连接条件
type JoinEliminationRule ¶
type JoinEliminationRule struct {
// contains filtered or unexported fields
}
JoinEliminationRule JOIN消除规则 消除冗余的JOIN操作,如1:1的外键主键JOIN
func NewJoinEliminationRule ¶
func NewJoinEliminationRule(estimator CardinalityEstimator) *JoinEliminationRule
NewJoinEliminationRule 创建JOIN消除规则
func (*JoinEliminationRule) Apply ¶
func (r *JoinEliminationRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则:消除冗余JOIN
func (*JoinEliminationRule) Match ¶
func (r *JoinEliminationRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type JoinReorderRule ¶
type JoinReorderRule struct {
// contains filtered or unexported fields
}
JoinReorderRule JOIN重排序规则 使用贪心算法选择最优的JOIN顺序
func NewJoinReorderRule ¶
func NewJoinReorderRule(estimator CardinalityEstimator, costModel CostModel) *JoinReorderRule
NewJoinReorderRule 创建JOIN重排序规则
func (*JoinReorderRule) Apply ¶
func (r *JoinReorderRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则:重排序JOIN顺序
func (*JoinReorderRule) Match ¶
func (r *JoinReorderRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type LimitPushDownRule ¶
type LimitPushDownRule struct{}
LimitPushDownRule Limit 下推规则 将 Limit 尽可能下推
func (*LimitPushDownRule) Apply ¶
func (r *LimitPushDownRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*LimitPushDownRule) Match ¶
func (r *LimitPushDownRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type LogicalAggregate ¶
type LogicalAggregate struct {
// contains filtered or unexported fields
}
LogicalAggregate 逻辑聚合
func NewLogicalAggregate ¶
func NewLogicalAggregate(aggFuncs []*AggregationItem, groupByCols []string, child LogicalPlan) *LogicalAggregate
NewLogicalAggregate 创建逻辑聚合
func (*LogicalAggregate) Algorithm ¶
func (p *LogicalAggregate) Algorithm() AggregationAlgorithm
Algorithm 返回聚合算法
func (*LogicalAggregate) Children ¶
func (p *LogicalAggregate) Children() []LogicalPlan
Children 获取子节点
func (*LogicalAggregate) GetAggFuncs ¶
func (p *LogicalAggregate) GetAggFuncs() []*AggregationItem
GetAggFuncs 返回聚合函数列表
func (*LogicalAggregate) GetAppliedHints ¶
func (p *LogicalAggregate) GetAppliedHints() []string
GetAppliedHints 获取已应用的 hints
func (*LogicalAggregate) GetGroupBy ¶
func (p *LogicalAggregate) GetGroupBy() []string
GetGroupBy 返回分组列列表 (别名)
func (*LogicalAggregate) GetGroupByCols ¶
func (p *LogicalAggregate) GetGroupByCols() []string
GetGroupByCols 返回分组列列表
func (*LogicalAggregate) SetAlgorithm ¶
func (p *LogicalAggregate) SetAlgorithm(algo AggregationAlgorithm)
SetAlgorithm 设置聚合算法
func (*LogicalAggregate) SetChildren ¶
func (p *LogicalAggregate) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalAggregate) SetHintApplied ¶
func (p *LogicalAggregate) SetHintApplied(hint string)
SetHintApplied 标记已应用的 hint
type LogicalApply ¶
type LogicalApply struct {
// contains filtered or unexported fields
}
LogicalApply represents a correlated subquery execution It executes the inner query for each row from the outer query
func NewLogicalApply ¶
func NewLogicalApply(joinType JoinType, outerPlan, innerPlan LogicalPlan, conditions []*parser.Expression) *LogicalApply
NewLogicalApply creates a new LogicalApply node
func (*LogicalApply) Children ¶
func (p *LogicalApply) Children() []LogicalPlan
Children returns the child plans
func (*LogicalApply) CorrelatedColumns ¶
func (p *LogicalApply) CorrelatedColumns() []CorrelatedColumn
CorrelatedColumns returns the correlated columns
func (*LogicalApply) Explain ¶
func (p *LogicalApply) Explain() string
Explain returns the plan description
func (*LogicalApply) GetConditions ¶
func (p *LogicalApply) GetConditions() []*parser.Expression
GetConditions returns the join conditions
func (*LogicalApply) GetJoinType ¶
func (p *LogicalApply) GetJoinType() JoinType
GetJoinType returns the join type
func (*LogicalApply) Schema ¶
func (p *LogicalApply) Schema() []ColumnInfo
Schema returns the output columns For Apply, schema is the combination of outer and inner schemas
func (*LogicalApply) SetChildren ¶
func (p *LogicalApply) SetChildren(children ...LogicalPlan)
SetChildren sets the child plans
func (*LogicalApply) SetCorrelatedColumns ¶
func (p *LogicalApply) SetCorrelatedColumns(cols []CorrelatedColumn)
SetCorrelatedColumns sets the correlated columns
type LogicalDataSource ¶
type LogicalDataSource struct {
TableName string
Columns []ColumnInfo
TableInfo *domain.TableInfo
Statistics *Statistics
// contains filtered or unexported fields
}
LogicalDataSource 逻辑数据源(表扫描)
func NewLogicalDataSource ¶
func NewLogicalDataSource(tableName string, tableInfo *domain.TableInfo) *LogicalDataSource
NewLogicalDataSource 创建逻辑数据源
func (*LogicalDataSource) Children ¶
func (p *LogicalDataSource) Children() []LogicalPlan
Children 获取子节点
func (*LogicalDataSource) ForceUseIndex ¶
func (p *LogicalDataSource) ForceUseIndex(indexName string)
ForceUseIndex 强制使用指定索引(FORCE_INDEX)
func (*LogicalDataSource) GetAppliedHints ¶
func (p *LogicalDataSource) GetAppliedHints() []string
GetAppliedHints 获取已应用的 hints
func (*LogicalDataSource) GetPushedDownLimit ¶
func (p *LogicalDataSource) GetPushedDownLimit() *LimitInfo
GetPushedDownLimit 获取下推的Limit
func (*LogicalDataSource) GetPushedDownPredicates ¶
func (p *LogicalDataSource) GetPushedDownPredicates() []*parser.Expression
GetPushedDownPredicates 获取下推的谓词条件
func (*LogicalDataSource) GetPushedDownTopN ¶
func (p *LogicalDataSource) GetPushedDownTopN() *TopNInfo
GetPushedDownTopN gets the TopN pushdown information
func (*LogicalDataSource) IgnoreIndex ¶
func (p *LogicalDataSource) IgnoreIndex(indexName string)
IgnoreIndex 忽略指定索引(IGNORE_INDEX)
func (*LogicalDataSource) IgnoreOrderIndex ¶
func (p *LogicalDataSource) IgnoreOrderIndex(indexName string)
IgnoreOrderIndex 忽略排序索引(NO_ORDER_INDEX)
func (*LogicalDataSource) PreferIndex ¶
func (p *LogicalDataSource) PreferIndex(indexName string)
PreferIndex 优先使用指定索引(USE_INDEX)
func (*LogicalDataSource) PushDownLimit ¶
func (p *LogicalDataSource) PushDownLimit(limit, offset int64)
PushDownLimit 添加下推的Limit
func (*LogicalDataSource) PushDownPredicates ¶
func (p *LogicalDataSource) PushDownPredicates(conditions []*parser.Expression)
PushDownPredicates 添加下推的谓词条件
func (*LogicalDataSource) SetChildren ¶
func (p *LogicalDataSource) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalDataSource) SetHintApplied ¶
func (p *LogicalDataSource) SetHintApplied(hint string)
SetHintApplied 标记已应用的 hint
func (*LogicalDataSource) SetOrderIndex ¶
func (p *LogicalDataSource) SetOrderIndex(indexName string)
SetOrderIndex 设置排序索引(ORDER_INDEX)
func (*LogicalDataSource) SetPushDownTopN ¶
func (p *LogicalDataSource) SetPushDownTopN(items []*parser.OrderItem, limit, offset int64)
SetPushDownTopN sets the TopN pushdown information
type LogicalDelete ¶
type LogicalDelete struct {
TableName string
Where *parser.Expression // WHERE 条件
OrderBy []*parser.OrderItem // ORDER BY
Limit *int64 // LIMIT
// contains filtered or unexported fields
}
LogicalDelete 逻辑删除计划
func NewLogicalDelete ¶
func NewLogicalDelete(tableName string) *LogicalDelete
NewLogicalDelete 创建逻辑删除计划
func (*LogicalDelete) GetOrderBy ¶
func (p *LogicalDelete) GetOrderBy() []*parser.OrderItem
GetOrderBy 获取 ORDER BY 列表
func (*LogicalDelete) GetTableName ¶
func (p *LogicalDelete) GetTableName() string
GetTableName 获取表名
func (*LogicalDelete) GetWhere ¶
func (p *LogicalDelete) GetWhere() *parser.Expression
GetWhere 获取 WHERE 条件
func (*LogicalDelete) Schema ¶
func (p *LogicalDelete) Schema() []ColumnInfo
Schema 返回输出列(DELETE 返回影响的行数)
func (*LogicalDelete) SetChildren ¶
func (p *LogicalDelete) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalDelete) SetOrderBy ¶
func (p *LogicalDelete) SetOrderBy(orderBy []*parser.OrderItem)
SetOrderBy 设置 ORDER BY
func (*LogicalDelete) SetWhere ¶
func (p *LogicalDelete) SetWhere(where *parser.Expression)
SetWhere 设置 WHERE 条件
type LogicalInsert ¶
type LogicalInsert struct {
TableName string
Columns []string // 指定列(为空时使用表的所有列)
Values [][]parser.Expression // 要插入的值(表达式)
OnDuplicate *LogicalUpdate // ON DUPLICATE KEY UPDATE
// contains filtered or unexported fields
}
LogicalInsert 逻辑插入计划
func NewLogicalInsert ¶
func NewLogicalInsert(tableName string, columns []string, values [][]parser.Expression) *LogicalInsert
NewLogicalInsert 创建逻辑插入计划
func NewLogicalInsertWithSelect ¶
func NewLogicalInsertWithSelect(tableName string, columns []string, selectPlan LogicalPlan) *LogicalInsert
NewLogicalInsertWithSelect 创建带有 SELECT 的插入计划
func (*LogicalInsert) GetSelectPlan ¶
func (p *LogicalInsert) GetSelectPlan() LogicalPlan
GetSelectPlan 获取 SELECT 子查询计划
func (*LogicalInsert) GetTableName ¶
func (p *LogicalInsert) GetTableName() string
GetTableName 获取表名
func (*LogicalInsert) GetValues ¶
func (p *LogicalInsert) GetValues() [][]parser.Expression
GetValues 获取值列表
func (*LogicalInsert) HasSelect ¶
func (p *LogicalInsert) HasSelect() bool
HasSelect 是否包含 SELECT 子查询
func (*LogicalInsert) Schema ¶
func (p *LogicalInsert) Schema() []ColumnInfo
Schema 返回输出列(INSERT 返回影响的行数等元信息)
func (*LogicalInsert) SetChildren ¶
func (p *LogicalInsert) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalInsert) SetOnDuplicate ¶
func (p *LogicalInsert) SetOnDuplicate(update *LogicalUpdate)
SetOnDuplicate 设置 ON DUPLICATE KEY UPDATE
type LogicalJoin ¶
type LogicalJoin struct {
LeftTable string
RightTable string
// contains filtered or unexported fields
}
LogicalJoin 逻辑连接
func NewLogicalJoin ¶
func NewLogicalJoin(joinType JoinType, left, right LogicalPlan, conditions []*JoinCondition) *LogicalJoin
NewLogicalJoin 创建逻辑连接
func NewLogicalJoinWithExprs ¶
func NewLogicalJoinWithExprs(joinType JoinType, left, right LogicalPlan, conditions []*parser.Expression) *LogicalJoin
NewLogicalJoinWithExprs creates a join with expression conditions
func (*LogicalJoin) GetConditions ¶
func (p *LogicalJoin) GetConditions() []*parser.Expression
GetConditions returns conditions as expressions
func (*LogicalJoin) GetJoinConditions ¶
func (p *LogicalJoin) GetJoinConditions() []*JoinCondition
GetJoinConditions 返回连接条件
func (*LogicalJoin) SetChildren ¶
func (p *LogicalJoin) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalJoin) SetHintApplied ¶
func (p *LogicalJoin) SetHintApplied(hintType string)
SetHintApplied 标记已应用的 hint
type LogicalLimit ¶
type LogicalLimit struct {
// contains filtered or unexported fields
}
LogicalLimit 逻辑限制
func NewLogicalLimit ¶
func NewLogicalLimit(limit, offset int64, child LogicalPlan) *LogicalLimit
NewLogicalLimit 创建逻辑限制
func (*LogicalLimit) SetChildren ¶
func (p *LogicalLimit) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
type LogicalPlan ¶
type LogicalPlan interface {
// Children 获取子节点
Children() []LogicalPlan
// SetChildren 设置子节点
SetChildren(children ...LogicalPlan)
// Schema 返回输出列
Schema() []ColumnInfo
// Explain 返回计划说明
Explain() string
}
LogicalPlan 逻辑计划接口
func UnionChildren ¶
func UnionChildren(children []LogicalPlan) []LogicalPlan
UnionChildren Union子节点访问器
type LogicalProjection ¶
type LogicalProjection struct {
Exprs []*parser.Expression
Columns []ColumnInfo
// contains filtered or unexported fields
}
LogicalProjection 逻辑投影
func NewLogicalProjection ¶
func NewLogicalProjection(exprs []*parser.Expression, aliases []string, child LogicalPlan) *LogicalProjection
NewLogicalProjection 创建逻辑投影
func (*LogicalProjection) Children ¶
func (p *LogicalProjection) Children() []LogicalPlan
Children 获取子节点
func (*LogicalProjection) GetAliases ¶
func (p *LogicalProjection) GetAliases() []string
GetAliases 返回别名列表
func (*LogicalProjection) GetExprs ¶
func (p *LogicalProjection) GetExprs() []*parser.Expression
GetExprs 返回投影表达式
func (*LogicalProjection) SetChildren ¶
func (p *LogicalProjection) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
type LogicalSelection ¶
type LogicalSelection struct {
// contains filtered or unexported fields
}
LogicalSelection 逻辑过滤(选择)
func NewLogicalSelection ¶
func NewLogicalSelection(conditions []*parser.Expression, child LogicalPlan) *LogicalSelection
NewLogicalSelection 创建逻辑过滤
func (*LogicalSelection) Children ¶
func (p *LogicalSelection) Children() []LogicalPlan
Children 获取子节点
func (*LogicalSelection) Conditions ¶
func (p *LogicalSelection) Conditions() []*parser.Expression
Conditions 返回过滤条件
func (*LogicalSelection) GetConditions ¶
func (p *LogicalSelection) GetConditions() []*parser.Expression
GetConditions 返回过滤条件(用于避免与Conditions方法冲突)
func (*LogicalSelection) Selectivity ¶
func (p *LogicalSelection) Selectivity() float64
Selectivity 返回选择率
func (*LogicalSelection) SetChildren ¶
func (p *LogicalSelection) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
type LogicalSort ¶
type LogicalSort struct {
// contains filtered or unexported fields
}
LogicalSort represents a logical sort operation
func NewLogicalSort ¶
func NewLogicalSort(orderBy []*parser.OrderItem, child LogicalPlan) *LogicalSort
NewLogicalSort creates a new LogicalSort node
func (*LogicalSort) Children ¶
func (p *LogicalSort) Children() []LogicalPlan
Children returns the child plans
func (*LogicalSort) Explain ¶
func (p *LogicalSort) Explain() string
Explain returns the plan description
func (*LogicalSort) GetOrderBy ¶
func (p *LogicalSort) GetOrderBy() []*parser.OrderItem
GetOrderBy returns the order by items
func (*LogicalSort) OrderBy ¶
func (p *LogicalSort) OrderBy() []*parser.OrderItem
OrderBy returns the order by items
func (*LogicalSort) Schema ¶
func (p *LogicalSort) Schema() []ColumnInfo
Schema returns the output columns
func (*LogicalSort) SetChildren ¶
func (p *LogicalSort) SetChildren(children ...LogicalPlan)
SetChildren sets the child plans
type LogicalTopN ¶
type LogicalTopN struct {
// contains filtered or unexported fields
}
LogicalTopN represents a TopN operation (Sort + Limit) It combines Sort and Limit into a single operator for optimization
func NewLogicalTopN ¶
func NewLogicalTopN(items []*parser.OrderItem, limit, offset int64, child LogicalPlan) *LogicalTopN
NewLogicalTopN creates a new LogicalTopN node
func (*LogicalTopN) Children ¶
func (p *LogicalTopN) Children() []LogicalPlan
Children returns the child plans
func (*LogicalTopN) Explain ¶
func (p *LogicalTopN) Explain() string
Explain returns the plan description
func (*LogicalTopN) GetLimit ¶
func (p *LogicalTopN) GetLimit() int64
GetLimit returns the limit count
func (*LogicalTopN) GetOffset ¶
func (p *LogicalTopN) GetOffset() int64
GetOffset returns the offset count
func (*LogicalTopN) Schema ¶
func (p *LogicalTopN) Schema() []ColumnInfo
Schema returns the output columns
func (*LogicalTopN) SetChildren ¶
func (p *LogicalTopN) SetChildren(children ...LogicalPlan)
SetChildren sets the child plans
func (*LogicalTopN) SetLimit ¶
func (p *LogicalTopN) SetLimit(limit int64)
SetLimit sets the limit count
func (*LogicalTopN) SetOffset ¶
func (p *LogicalTopN) SetOffset(offset int64)
SetOffset sets the offset count
func (*LogicalTopN) SortItems ¶
func (p *LogicalTopN) SortItems() []*parser.OrderItem
SortItems returns the sort items
type LogicalUnion ¶
type LogicalUnion struct {
// contains filtered or unexported fields
}
LogicalUnion 逻辑UNION操作符 用于合并多个子查询的结果集
func NewLogicalUnion ¶
func NewLogicalUnion(children []LogicalPlan) *LogicalUnion
NewLogicalUnion 创建逻辑UNION
func (*LogicalUnion) SetChildren ¶
func (p *LogicalUnion) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
type LogicalUpdate ¶
type LogicalUpdate struct {
TableName string
Set map[string]parser.Expression // 列名 -> 表达式
Where *parser.Expression // WHERE 条件
OrderBy []*parser.OrderItem // ORDER BY
Limit *int64 // LIMIT
// contains filtered or unexported fields
}
LogicalUpdate 逻辑更新计划
func NewLogicalUpdate ¶
func NewLogicalUpdate(tableName string, set map[string]parser.Expression) *LogicalUpdate
NewLogicalUpdate 创建逻辑更新计划
func (*LogicalUpdate) GetOrderBy ¶
func (p *LogicalUpdate) GetOrderBy() []*parser.OrderItem
GetOrderBy 获取 ORDER BY 列表
func (*LogicalUpdate) GetSet ¶
func (p *LogicalUpdate) GetSet() map[string]parser.Expression
GetSet 获取 SET 映射
func (*LogicalUpdate) GetTableName ¶
func (p *LogicalUpdate) GetTableName() string
GetTableName 获取表名
func (*LogicalUpdate) GetWhere ¶
func (p *LogicalUpdate) GetWhere() *parser.Expression
GetWhere 获取 WHERE 条件
func (*LogicalUpdate) Schema ¶
func (p *LogicalUpdate) Schema() []ColumnInfo
Schema 返回输出列(UPDATE 返回影响的行数)
func (*LogicalUpdate) SetChildren ¶
func (p *LogicalUpdate) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
func (*LogicalUpdate) SetOrderBy ¶
func (p *LogicalUpdate) SetOrderBy(orderBy []*parser.OrderItem)
SetOrderBy 设置 ORDER BY
func (*LogicalUpdate) SetWhere ¶
func (p *LogicalUpdate) SetWhere(where *parser.Expression)
SetWhere 设置 WHERE 条件
type LogicalVectorScan ¶
type LogicalVectorScan struct {
TableName string
ColumnName string
QueryVector []float32
K int
MetricType string
Offset int
// contains filtered or unexported fields
}
LogicalVectorScan 向量扫描逻辑节点
func NewLogicalVectorScan ¶
func NewLogicalVectorScan(tableName, columnName string, queryVector []float32, k int, metricType string) *LogicalVectorScan
NewLogicalVectorScan 创建向量扫描逻辑节点
func (*LogicalVectorScan) Children ¶
func (l *LogicalVectorScan) Children() []LogicalPlan
Children 获取子节点
func (*LogicalVectorScan) EstimateCardinality ¶
func (l *LogicalVectorScan) EstimateCardinality() int64
EstimateCardinality 估算基数
func (*LogicalVectorScan) Schema ¶
func (l *LogicalVectorScan) Schema() []ColumnInfo
Schema 返回输出 schema
func (*LogicalVectorScan) SetChildren ¶
func (l *LogicalVectorScan) SetChildren(children ...LogicalPlan)
SetChildren 设置子节点
type LogicalWindow ¶
type LogicalWindow struct {
// contains filtered or unexported fields
}
LogicalWindow represents a logical window function operation
func NewLogicalWindow ¶
func NewLogicalWindow(windowFuncs []*WindowFunctionItem, child LogicalPlan) *LogicalWindow
NewLogicalWindow creates a new LogicalWindow node
func (*LogicalWindow) Children ¶
func (p *LogicalWindow) Children() []LogicalPlan
Children returns the child plans
func (*LogicalWindow) Explain ¶
func (p *LogicalWindow) Explain() string
Explain returns the plan description
func (*LogicalWindow) Schema ¶
func (p *LogicalWindow) Schema() []ColumnInfo
Schema returns the output columns
func (*LogicalWindow) SetChildren ¶
func (p *LogicalWindow) SetChildren(children ...LogicalPlan)
SetChildren sets the child plans
func (*LogicalWindow) WindowFuncs ¶
func (p *LogicalWindow) WindowFuncs() []*WindowFunctionItem
WindowFuncs returns the window function items
type MaxMinEliminationRule ¶
type MaxMinEliminationRule struct {
// contains filtered or unexported fields
}
MaxMinEliminationRule eliminates MAX/MIN aggregations by converting them to TopN operations
func NewMaxMinEliminationRule ¶
func NewMaxMinEliminationRule(estimator CardinalityEstimator) *MaxMinEliminationRule
NewMaxMinEliminationRule creates a new MaxMinEliminationRule
func (*MaxMinEliminationRule) Apply ¶
func (r *MaxMinEliminationRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the rule to the plan
func (*MaxMinEliminationRule) Match ¶
func (r *MaxMinEliminationRule) Match(plan LogicalPlan) bool
Match checks if the rule can be applied to the plan
func (*MaxMinEliminationRule) Name ¶
func (r *MaxMinEliminationRule) Name() string
Name returns the rule name
type MemoryPool ¶
type MemoryPool struct {
// contains filtered or unexported fields
}
MemoryPool 内存池(用于重用对象减少GC压力)
func (*MemoryPool) SetPool ¶
func (mp *MemoryPool) SetPool(key string, pool interface{})
SetPool 设置指定类型的池
type MergerIndex ¶
type MergerIndex struct {
TableName string
Columns []string
Unique bool
Name string
Size int64 // 索引大小(字节)
}
MergerIndex 索引定义(用于合并器)
type ORToUnionRule ¶
type ORToUnionRule struct{}
ORToUnionRule OR转UNION规则 将包含OR条件的Selection转换为UNION
func (*ORToUnionRule) Apply ¶
func (r *ORToUnionRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*ORToUnionRule) Explain ¶
func (r *ORToUnionRule) Explain(result LogicalPlan) string
Explain 解释规则应用
type OptimizationContext ¶
type OptimizationContext struct {
DataSource domain.DataSource
TableInfo map[string]*domain.TableInfo
Stats map[string]*Statistics
CostModel CostModel
Hints *OptimizerHints // 添加优化器 hints
}
OptimizationContext 优化上下文
type OptimizationRule ¶
type OptimizationRule interface {
// Name 规则名称
Name() string
// Match 检查规则是否匹配
Match(plan LogicalPlan) bool
// Apply 应用规则,返回优化后的计划
Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
}
OptimizationRule 优化规则接口
type OptimizedAggregate ¶
type OptimizedAggregate struct {
AggFuncs []*AggregationItem
GroupByCols []string
// contains filtered or unexported fields
}
OptimizedAggregate 优化的物理聚合算子 基于 DuckDB Perfect Hash Aggregation 和 TiDB 聚合优化策略
func NewOptimizedAggregate ¶
func NewOptimizedAggregate(aggFuncs []*AggregationItem, groupByCols []string, child PhysicalPlan) *OptimizedAggregate
NewOptimizedAggregate 创建优化的聚合算子
func (*OptimizedAggregate) Children ¶
func (p *OptimizedAggregate) Children() []PhysicalPlan
Children 获取子节点
func (*OptimizedAggregate) Execute ¶
func (p *OptimizedAggregate) Execute(ctx context.Context) (*domain.QueryResult, error)
Execute 执行优化的聚合 DEPRECATED: 执行逻辑已迁移到 pkg/executor 包,此方法保留仅为兼容性
func (*OptimizedAggregate) SetChildren ¶
func (p *OptimizedAggregate) SetChildren(children ...PhysicalPlan)
SetChildren 设置子节点
type OptimizedExecutor ¶
type OptimizedExecutor struct {
// contains filtered or unexported fields
}
OptimizedExecutor 优化的执行器 集成 Optimizer 和 QueryBuilder,提供优化后的查询执行
func NewOptimizedExecutor ¶
func NewOptimizedExecutor(dataSource domain.DataSource, useOptimizer bool) *OptimizedExecutor
NewOptimizedExecutor 创建优化的执行器
func NewOptimizedExecutorWithDSManager ¶
func NewOptimizedExecutorWithDSManager(dataSource domain.DataSource, dsManager *application.DataSourceManager, useOptimizer bool) *OptimizedExecutor
NewOptimizedExecutorWithDSManager 创建带有数据源管理器的优化执行器
func (*OptimizedExecutor) ExecuteAlter ¶
func (e *OptimizedExecutor) ExecuteAlter(ctx context.Context, stmt *parser.AlterStatement) (*domain.QueryResult, error)
ExecuteAlter 执行 ALTER
func (*OptimizedExecutor) ExecuteCreate ¶
func (e *OptimizedExecutor) ExecuteCreate(ctx context.Context, stmt *parser.CreateStatement) (*domain.QueryResult, error)
ExecuteCreate 执行 CREATE
func (*OptimizedExecutor) ExecuteCreateIndex ¶
func (e *OptimizedExecutor) ExecuteCreateIndex(ctx context.Context, stmt *parser.CreateIndexStatement) (*domain.QueryResult, error)
ExecuteCreateIndex 执行 CREATE INDEX
func (*OptimizedExecutor) ExecuteDelete ¶
func (e *OptimizedExecutor) ExecuteDelete(ctx context.Context, stmt *parser.DeleteStatement) (*domain.QueryResult, error)
ExecuteDelete 执行 DELETE
func (*OptimizedExecutor) ExecuteDrop ¶
func (e *OptimizedExecutor) ExecuteDrop(ctx context.Context, stmt *parser.DropStatement) (*domain.QueryResult, error)
ExecuteDrop 执行 DROP
func (*OptimizedExecutor) ExecuteDropIndex ¶
func (e *OptimizedExecutor) ExecuteDropIndex(ctx context.Context, stmt *parser.DropIndexStatement) (*domain.QueryResult, error)
ExecuteDropIndex 执行 DROP INDEX
func (*OptimizedExecutor) ExecuteInsert ¶
func (e *OptimizedExecutor) ExecuteInsert(ctx context.Context, stmt *parser.InsertStatement) (*domain.QueryResult, error)
ExecuteInsert 执行 INSERT
func (*OptimizedExecutor) ExecuteSelect ¶
func (e *OptimizedExecutor) ExecuteSelect(ctx context.Context, stmt *parser.SelectStatement) (*domain.QueryResult, error)
ExecuteSelect 执行 SELECT 查询(支持优化)
func (*OptimizedExecutor) ExecuteShow ¶
func (e *OptimizedExecutor) ExecuteShow(ctx context.Context, showStmt *parser.ShowStatement) (*domain.QueryResult, error)
ExecuteShow 执行 SHOW 语句 - 转换为 information_schema 查询
func (*OptimizedExecutor) ExecuteUpdate ¶
func (e *OptimizedExecutor) ExecuteUpdate(ctx context.Context, stmt *parser.UpdateStatement) (*domain.QueryResult, error)
ExecuteUpdate 执行 UPDATE
func (*OptimizedExecutor) GetCurrentDB ¶
func (e *OptimizedExecutor) GetCurrentDB() string
GetCurrentDB 获取当前数据库
func (*OptimizedExecutor) GetCurrentUser ¶
func (e *OptimizedExecutor) GetCurrentUser() string
GetCurrentUser 获取当前用户
func (*OptimizedExecutor) GetOptimizer ¶
func (e *OptimizedExecutor) GetOptimizer() *EnhancedOptimizer
GetOptimizer 获取优化器
func (*OptimizedExecutor) GetQueryBuilder ¶
func (e *OptimizedExecutor) GetQueryBuilder() interface{}
GetQueryBuilder 获取底层的 QueryBuilder(如果存在) 用于设置当前数据库上下文
func (*OptimizedExecutor) SetCurrentDB ¶
func (e *OptimizedExecutor) SetCurrentDB(dbName string)
SetCurrentDB 设置当前数据库
func (*OptimizedExecutor) SetCurrentUser ¶
func (e *OptimizedExecutor) SetCurrentUser(user string)
SetCurrentUser 设置当前用户
func (*OptimizedExecutor) SetUseOptimizer ¶
func (e *OptimizedExecutor) SetUseOptimizer(use bool)
SetUseOptimizer 设置是否使用优化器
func (*OptimizedExecutor) SetVirtualDBRegistry ¶
func (e *OptimizedExecutor) SetVirtualDBRegistry(registry *virtual.VirtualDatabaseRegistry)
SetVirtualDBRegistry 设置虚拟数据库注册表
type OptimizedParallelScanner ¶
type OptimizedParallelScanner struct {
// contains filtered or unexported fields
}
OptimizedParallelScanner 优化的并行扫描器 基于 TiDB 多线程并发模型,使用 Worker Pool 和批量处理
func NewOptimizedParallelScanner ¶
func NewOptimizedParallelScanner(dataSource domain.DataSource, parallelism int) *OptimizedParallelScanner
NewOptimizedParallelScanner 创建优化的并行扫描器 parallelism: 并行度,0 表示自动选择最优值 Default: min(runtime.NumCPU(), 8) with range [4, 8]
func (*OptimizedParallelScanner) Close ¶
func (ops *OptimizedParallelScanner) Close() error
Close releases resources
func (*OptimizedParallelScanner) Execute ¶
func (ops *OptimizedParallelScanner) Execute(ctx context.Context, scanRange ScanRange, options *domain.QueryOptions) (*domain.QueryResult, error)
Execute 优化的并行执行扫描
func (*OptimizedParallelScanner) Explain ¶
func (ops *OptimizedParallelScanner) Explain() string
Explain 解释优化的并行扫描器
func (*OptimizedParallelScanner) GetParallelism ¶
func (ops *OptimizedParallelScanner) GetParallelism() int
GetParallelism 获取并行度
func (*OptimizedParallelScanner) SetParallelism ¶
func (ops *OptimizedParallelScanner) SetParallelism(parallelism int)
SetParallelism 设置并行度 Recommended range: 4-8 workers (based on performance benchmarks) parallelism <= 0: auto-select using min(runtime.NumCPU(), 8) parallelism > 8: limited to 8 for optimal performance
type OptimizerHints ¶
type OptimizerHints struct {
// JOIN hints
HashJoinTables []string
MergeJoinTables []string
INLJoinTables []string
INLHashJoinTables []string
INLMergeJoinTables []string
NoHashJoinTables []string
NoMergeJoinTables []string
NoIndexJoinTables []string
LeadingOrder []string
StraightJoin bool
// INDEX hints
UseIndex map[string][]string // table -> index list
ForceIndex map[string][]string // table -> index list
IgnoreIndex map[string][]string // table -> index list
OrderIndex map[string]string // table -> index name
NoOrderIndex map[string]string // table -> index name
// AGG hints
HashAgg bool
StreamAgg bool
MPP1PhaseAgg bool
MPP2PhaseAgg bool
// Subquery hints
SemiJoinRewrite bool
NoDecorrelate bool
UseTOJA bool
// Global hints
QBName string
MaxExecutionTime time.Duration
MemoryQuota int64
ReadConsistentReplica bool
ResourceGroup string
}
OptimizerHints 优化器 hints(TiDB 兼容)
type OrderByHintRule ¶
type OrderByHintRule struct {
// contains filtered or unexported fields
}
OrderByHintRule ORDER BY Hints优化规则 支持 ORDER_INDEX 和 NO_ORDER_INDEX hints
func NewOrderByHintRule ¶
func NewOrderByHintRule(estimator CardinalityEstimator) *OrderByHintRule
NewOrderByHintRule 创建ORDER BY Hints规则
func (*OrderByHintRule) Apply ¶
func (r *OrderByHintRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*OrderByHintRule) EstimateSortCost ¶
func (r *OrderByHintRule) EstimateSortCost(plan *LogicalSort, optCtx *OptimizationContext) float64
EstimateSortCost 估算排序成本(考虑hints)
func (*OrderByHintRule) Explain ¶
func (r *OrderByHintRule) Explain() string
Explain 解释ORDER BY Hints规则
func (*OrderByHintRule) GetOrderByItems ¶
func (r *OrderByHintRule) GetOrderByItems(plan *LogicalSort) []OrderByItem
GetOrderByItems 获取排序项
func (*OrderByHintRule) GetRecommendedSortMethod ¶
func (r *OrderByHintRule) GetRecommendedSortMethod(plan *LogicalSort, optCtx *OptimizationContext) string
GetRecommendedSortMethod 根据hints获取推荐的排序方法
func (*OrderByHintRule) Match ¶
func (r *OrderByHintRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type OrderByItem ¶
OrderByItem 排序项
func SortOrderByItems ¶
func SortOrderByItems(orderBy []OrderByItem) []OrderByItem
SortOrderByItems 排序项访问器
type PerformanceOptimizer ¶
type PerformanceOptimizer struct {
// contains filtered or unexported fields
}
PerformanceOptimizer 性能优化器
func NewPerformanceOptimizer ¶
func NewPerformanceOptimizer() *PerformanceOptimizer
NewPerformanceOptimizer 创建性能优化器
func (*PerformanceOptimizer) EstimateJoinSelectivity ¶
func (po *PerformanceOptimizer) EstimateJoinSelectivity(leftTable, rightTable string, optCtx *OptimizationContext) float64
EstimateJoinSelectivity 估算JOIN的选择性
func (*PerformanceOptimizer) EstimateSelectivity ¶
func (po *PerformanceOptimizer) EstimateSelectivity(filter Filter, stats *Statistics) float64
EstimateSelectivity 估计过滤条件的选择性 基于统计信息计算过滤条件的选择性,提高优化决策的准确性
func (*PerformanceOptimizer) OptimizeQuery ¶
func (po *PerformanceOptimizer) OptimizeQuery(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
OptimizeQuery 优化查询
func (*PerformanceOptimizer) OptimizeScan ¶
func (po *PerformanceOptimizer) OptimizeScan(tableName string, filters []Filter, optCtx *OptimizationContext) *ScanOptimization
OptimizeScan 优化扫描操作
type PhysicalHashAggregate ¶
type PhysicalHashAggregate struct {
AggFuncs []*AggregationItem
GroupByCols []string
// contains filtered or unexported fields
}
PhysicalHashAggregate 物理哈希聚合 在重构完成前,暂时保留原始实现
func NewPhysicalHashAggregate ¶
func NewPhysicalHashAggregate(aggFuncs []*AggregationItem, groupByCols []string, child PhysicalPlan) *PhysicalHashAggregate
NewPhysicalHashAggregate 创建物理哈希聚合
type PhysicalHashJoin ¶
type PhysicalHashJoin struct {
JoinType JoinType
Conditions []*JoinCondition
// contains filtered or unexported fields
}
PhysicalHashJoin 物理哈希连接 在重构完成前,暂时保留原始实现
func NewPhysicalHashJoin ¶
func NewPhysicalHashJoin(joinType JoinType, left, right PhysicalPlan, conditions []*JoinCondition) *PhysicalHashJoin
NewPhysicalHashJoin 创建物理哈希连接
type PhysicalLimit ¶
PhysicalLimit 物理限制 在重构完成前,暂时保留原始实现
func NewPhysicalLimit ¶
func NewPhysicalLimit(limit, offset int64, child PhysicalPlan) *PhysicalLimit
NewPhysicalLimit 创建物理限制
type PhysicalMergeJoin ¶
type PhysicalMergeJoin struct {
JoinType JoinType
Conditions []*JoinCondition
// contains filtered or unexported fields
}
PhysicalMergeJoin 物理归并连接 基于两路归并排序的连接算法,适合有序数据
func NewPhysicalMergeJoin ¶
func NewPhysicalMergeJoin(joinType JoinType, left, right PhysicalPlan, conditions []*JoinCondition) *PhysicalMergeJoin
NewPhysicalMergeJoin 创建物理归并连接
func (*PhysicalMergeJoin) Children ¶
func (p *PhysicalMergeJoin) Children() []PhysicalPlan
Children 获取子节点
func (*PhysicalMergeJoin) Execute ¶
func (p *PhysicalMergeJoin) Execute(ctx context.Context) (*domain.QueryResult, error)
Execute 执行归并连接 DEPRECATED: 执行逻辑已迁移到 pkg/executor 包,此方法保留仅为兼容性
func (*PhysicalMergeJoin) SetChildren ¶
func (p *PhysicalMergeJoin) SetChildren(children ...PhysicalPlan)
SetChildren 设置子节点
type PhysicalPlan ¶
type PhysicalPlan interface {
// Children 获取子节点
Children() []PhysicalPlan
// SetChildren 设置子节点
SetChildren(children ...PhysicalPlan)
// Schema 返回输出列
Schema() []ColumnInfo
// Cost 返回执行成本
Cost() float64
// Explain 返回计划说明
Explain() string
}
PhysicalPlan 物理计划接口
type PhysicalProjection ¶
type PhysicalProjection struct {
Exprs []*parser.Expression
Aliases []string
Columns []ColumnInfo
// contains filtered or unexported fields
}
PhysicalProjection 物理投影 在重构完成前,暂时保留原始实现
func NewPhysicalProjection ¶
func NewPhysicalProjection(exprs []*parser.Expression, aliases []string, child PhysicalPlan) *PhysicalProjection
NewPhysicalProjection 创建物理投影
type PhysicalSelection ¶
type PhysicalSelection struct {
Conditions []*parser.Expression
Filters []domain.Filter
// contains filtered or unexported fields
}
PhysicalSelection 物理过滤 在重构完成前,暂时保留原始实现
func NewPhysicalSelection ¶
func NewPhysicalSelection(conditions []*parser.Expression, filters []domain.Filter, child PhysicalPlan, dataSource domain.DataSource) *PhysicalSelection
NewPhysicalSelection 创建物理过滤
type PhysicalSort ¶
type PhysicalSort struct {
OrderByItems []*OrderByItem
// contains filtered or unexported fields
}
PhysicalSort 物理排序
func NewPhysicalSort ¶
func NewPhysicalSort(orderByItems []*OrderByItem, child PhysicalPlan) *PhysicalSort
NewPhysicalSort 创建物理排序
func (*PhysicalSort) Execute ¶
func (p *PhysicalSort) Execute(ctx context.Context) (*domain.QueryResult, error)
Execute 执行排序 DEPRECATED: 执行逻辑已迁移到 pkg/executor 包,此方法保留仅为兼容性
func (*PhysicalSort) SetChildren ¶
func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)
SetChildren 设置子节点
type PhysicalTableScan ¶
type PhysicalTableScan struct {
TableName string
Columns []ColumnInfo
TableInfo *domain.TableInfo
// contains filtered or unexported fields
}
PhysicalTableScan 物理表扫描(已重构到pkg/optimizer/physical包) 在重构完成前,暂时保留原始实现
func NewPhysicalTableScan ¶
func NewPhysicalTableScan(tableName string, tableInfo *domain.TableInfo, dataSource domain.DataSource, filters []domain.Filter, limitInfo *LimitInfo) *PhysicalTableScan
NewPhysicalTableScan 创建物理表扫描
func (*PhysicalTableScan) Execute ¶
func (p *PhysicalTableScan) Execute(ctx context.Context) (*domain.QueryResult, error)
Execute 执行扫描
type PlanCache ¶
type PlanCache struct {
// contains filtered or unexported fields
}
PlanCache implements a DQ-inspired plan cache. In the DQ paper, the Q-table maps state → optimal action. Here we map SQL fingerprint → optimized execution plan.
func NewPlanCache ¶
NewPlanCache creates a plan cache with the given maximum size.
func (*PlanCache) Invalidate ¶
func (pc *PlanCache) Invalidate()
Invalidate removes all cached plans (e.g., after DDL).
func (*PlanCache) UpdateCost ¶
UpdateCost records the actual execution cost for a cached plan (DQ reward feedback).
type PlanConverter ¶
type PlanConverter struct {
// contains filtered or unexported fields
}
PlanConverter converts logical plans to physical plans This is shared between EnhancedOptimizer and EnhancedOptimizerV2
func NewPlanConverter ¶
func NewPlanConverter(costModel cost.CostModel, indexSelector IndexSelector) *PlanConverter
NewPlanConverter creates a new plan converter
func (*PlanConverter) ConvertToPlan ¶
func (pc *PlanConverter) ConvertToPlan(ctx context.Context, logicalPlan LogicalPlan, optCtx *OptimizationContext) (*plan.Plan, error)
ConvertToPlan converts a logical plan to a physical plan
type PlanNode ¶
type PlanNode struct {
Plan LogicalPlan
Cost float64
Priority int
Index int
}
PlanPlan 计划节点
type PredicatePushDownRule ¶
type PredicatePushDownRule struct{}
PredicatePushDownRule predicate pushdown rule Pushes Selection node predicates down to DataSource as much as possible
func (*PredicatePushDownRule) Apply ¶
func (r *PredicatePushDownRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the rule
func (*PredicatePushDownRule) Match ¶
func (r *PredicatePushDownRule) Match(plan LogicalPlan) bool
Match checks if rule matches
func (*PredicatePushDownRule) Name ¶
func (r *PredicatePushDownRule) Name() string
Name returns rule name
type ProcedureExecutor ¶
type ProcedureExecutor struct {
// contains filtered or unexported fields
}
ProcedureExecutor 存储过程执行器
func NewProcedureExecutor ¶
func NewProcedureExecutor() *ProcedureExecutor
NewProcedureExecutor 创建存储过程执行器
func (*ProcedureExecutor) ExecuteFunction ¶
func (pe *ProcedureExecutor) ExecuteFunction(ctx context.Context, name string, args ...interface{}) (interface{}, error)
ExecuteFunction 执行函数
func (*ProcedureExecutor) ExecuteProcedure ¶
func (pe *ProcedureExecutor) ExecuteProcedure(ctx context.Context, name string, args ...interface{}) ([]map[string]interface{}, error)
ExecuteProcedure 执行存储过程
func (*ProcedureExecutor) RegisterFunction ¶
func (pe *ProcedureExecutor) RegisterFunction(fn *parser.FunctionInfo) error
RegisterFunction 注册函数
func (*ProcedureExecutor) RegisterProcedure ¶
func (pe *ProcedureExecutor) RegisterProcedure(proc *parser.ProcedureInfo) error
RegisterProcedure 注册存储过程
type ProcessListProvider ¶
type ProcessListProvider func() []interface{}
ProcessListProvider 进程列表提供者函数类型(用于避免循环依赖)
type ProjectionEliminationRule ¶
type ProjectionEliminationRule struct{}
ProjectionEliminationRule 投影消除规则 移除不必要的投影节点
func (*ProjectionEliminationRule) Apply ¶
func (r *ProjectionEliminationRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则
func (*ProjectionEliminationRule) Match ¶
func (r *ProjectionEliminationRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
func (*ProjectionEliminationRule) Name ¶
func (r *ProjectionEliminationRule) Name() string
Name 返回规则名称
type PushDecision ¶
type PushDecision int
PushDecision 下推决策
const ( PushNone PushDecision = iota PushLeft PushRight PushBoth )
type RefreshTask ¶
type RefreshTask struct {
TableName string
Reason string
Priority int // 优先级:0=低, 1=中, 2=高
Timestamp time.Time
}
RefreshTask 刷新任务
type Result ¶
type Result struct {
Columns []domain.ColumnInfo
Rows []map[string]interface{}
Total int64
}
Result 查询结果(简化版,避免循环依赖)
type RuleExecutor ¶
type RuleExecutor struct {
// contains filtered or unexported fields
}
RuleExecutor 规则执行器
func (*RuleExecutor) Execute ¶
func (re *RuleExecutor) Execute(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Execute 执行所有规则
type RuleSet ¶
type RuleSet []OptimizationRule
RuleSet 规则集合
func EnhancedRuleSet ¶
func EnhancedRuleSet(estimator CardinalityEstimator) RuleSet
EnhancedRuleSet 返回增强规则集(包含新规则和 hint-aware 规则)
func (RuleSet) Apply ¶
func (rs RuleSet) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用所有规则
type ScanOptimization ¶
ScanOptimization 扫描优化建议
type Scope ¶
Scope 变量作用域
func (*Scope) GetVariable ¶
GetVariable 获取变量值
func (*Scope) SetVariable ¶
SetVariable 设置变量值
type SemiJoinRewriteRule ¶
type SemiJoinRewriteRule struct {
// contains filtered or unexported fields
}
SemiJoinRewriteRule 半连接重写规则 将EXISTS和IN子查询重写为更高效的连接形式
func NewSemiJoinRewriteRule ¶
func NewSemiJoinRewriteRule(estimator CardinalityEstimator) *SemiJoinRewriteRule
NewSemiJoinRewriteRule 创建半连接重写规则
func (*SemiJoinRewriteRule) Apply ¶
func (r *SemiJoinRewriteRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用规则:重写半连接
func (*SemiJoinRewriteRule) Match ¶
func (r *SemiJoinRewriteRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配
type SessionVariableManager ¶
type SessionVariableManager struct {
// contains filtered or unexported fields
}
SessionVariableManager 是会话变量管理器
func NewSessionVariableManager ¶
func NewSessionVariableManager(global *DefaultVariableManager) *SessionVariableManager
NewSessionVariableManager 创建会话变量管理器
func (*SessionVariableManager) GetVariable ¶
func (svm *SessionVariableManager) GetVariable(name string) (interface{}, bool)
GetVariable 获取变量值(优先从会话变量获取)
func (*SessionVariableManager) GetVariableNames ¶
func (svm *SessionVariableManager) GetVariableNames() []string
GetVariableNames 返回所有变量名
func (*SessionVariableManager) ListVariables ¶
func (svm *SessionVariableManager) ListVariables() map[string]interface{}
ListVariables 返回所有变量(合并会话和全局)
func (*SessionVariableManager) SetVariable ¶
func (svm *SessionVariableManager) SetVariable(name string, value interface{}) error
SetVariable 设置变量值
type ShowExecutor ¶
type ShowExecutor struct {
// contains filtered or unexported fields
}
ShowExecutor SHOW 语句执行器
func NewShowExecutor ¶
func NewShowExecutor(currentDB string, dsManager interface{}, executeWithBuilder func(ctx context.Context, stmt *parser.SelectStatement) (*domain.QueryResult, error)) *ShowExecutor
NewShowExecutor 创建 SHOW 语句执行器
func (*ShowExecutor) ExecuteShow ¶
func (e *ShowExecutor) ExecuteShow(ctx context.Context, showStmt *parser.ShowStatement) (*domain.QueryResult, error)
ExecuteShow 执行 SHOW 语句 - 转换为 information_schema 查询
func (*ShowExecutor) SetCurrentDB ¶
func (e *ShowExecutor) SetCurrentDB(dbName string)
SetCurrentDB 设置当前数据库
type SimpleCardinalityEstimator ¶
type SimpleCardinalityEstimator struct {
// contains filtered or unexported fields
}
SimpleCardinalityEstimator 简化的基数估算器
func NewSimpleCardinalityEstimator ¶
func NewSimpleCardinalityEstimator() *SimpleCardinalityEstimator
NewSimpleCardinalityEstimator 创建简化基数估算器
func (*SimpleCardinalityEstimator) EstimateDistinct ¶
func (e *SimpleCardinalityEstimator) EstimateDistinct(table string, columns []string) int64
EstimateDistinct 估算DISTINCT后的行数
func (*SimpleCardinalityEstimator) EstimateFilter ¶
func (e *SimpleCardinalityEstimator) EstimateFilter(table string, filters []domain.Filter) int64
EstimateFilter 估算过滤后的基数
func (*SimpleCardinalityEstimator) EstimateJoin ¶
func (e *SimpleCardinalityEstimator) EstimateJoin(left, right LogicalPlan, joinType JoinType) int64
EstimateJoin 估算JOIN的基数
func (*SimpleCardinalityEstimator) EstimateTableScan ¶
func (e *SimpleCardinalityEstimator) EstimateTableScan(tableName string) int64
EstimateTableScan 估算表扫描基数
func (*SimpleCardinalityEstimator) UpdateStatistics ¶
func (e *SimpleCardinalityEstimator) UpdateStatistics(tableName string, stats *TableStatistics)
UpdateStatistics 更新统计信息
type SimpleExpressionContext ¶
type SimpleExpressionContext struct {
// contains filtered or unexported fields
}
SimpleExpressionContext 是一个简单的 ExpressionContext 实现
func NewSimpleExpressionContext ¶
func NewSimpleExpressionContext(row parser.Row) *SimpleExpressionContext
NewSimpleExpressionContext 创建简单的表达式上下文
func (*SimpleExpressionContext) GetCurrentTime ¶
func (ctx *SimpleExpressionContext) GetCurrentTime() interface{}
GetCurrentTime 获取当前时间
func (*SimpleExpressionContext) GetFunction ¶
func (ctx *SimpleExpressionContext) GetFunction(funcName string) (interface{}, bool)
GetFunction 获取函数
func (*SimpleExpressionContext) GetRowValue ¶
func (ctx *SimpleExpressionContext) GetRowValue(colName string) (interface{}, bool)
GetRowValue 获取行值
func (*SimpleExpressionContext) GetVariable ¶
func (ctx *SimpleExpressionContext) GetVariable(varName string) (interface{}, bool)
GetVariable 获取变量值
func (*SimpleExpressionContext) SetVariable ¶
func (ctx *SimpleExpressionContext) SetVariable(name string, value interface{})
SetVariable 设置变量
type SpatialIndexCandidate ¶
type SpatialIndexCandidate struct {
TableName string
ColumnName string // 支持的列类型:GEOMETRY, POINT, LINESTRING, POLYGON
IndexSubType string // 具体子类型:POINT, LINESTRING, POLYGON, MULTIPOLYGON
}
SpatialIndexCandidate 空间索引候选
type SpatialIndexSupport ¶
type SpatialIndexSupport struct {
// 支持的空间数据类型
SupportedTypes []string
}
SpatialIndexSupport 空间索引支持
func NewSpatialIndexSupport ¶
func NewSpatialIndexSupport() *SpatialIndexSupport
NewSpatialIndexSupport 创建空间索引支持实例
func (*SpatialIndexSupport) CalculateIndexSelectivity ¶
func (sis *SpatialIndexSupport) CalculateIndexSelectivity( funcName string, queryRange string, dataRange string, ) float64
CalculateIndexSelectivity 计算空间索引的选择性
func (*SpatialIndexSupport) CalculateSpatialQueryBenefit ¶
func (sis *SpatialIndexSupport) CalculateSpatialQueryBenefit( funcName string, rowCount int64, queryArea string, ) float64
CalculateSpatialQueryBenefit 计算空间查询的收益
func (*SpatialIndexSupport) CanUseSpatialIndex ¶
func (sis *SpatialIndexSupport) CanUseSpatialIndex(funcName string, args []string) bool
CanUseSpatialIndex 检查空间查询是否可以使用空间索引
func (*SpatialIndexSupport) EstimateMBRSize ¶
func (sis *SpatialIndexSupport) EstimateMBRSize( subType string, estimatedSize int64, ) float64
EstimateMBRSize 估算最小边界框大小(用于查询优化)
func (*SpatialIndexSupport) EstimateSpatialIndexStats ¶
func (sis *SpatialIndexSupport) EstimateSpatialIndexStats( tableName string, columnName string, columnType string, rowCount int64, ) *HypotheticalIndexStats
EstimateSpatialIndexStats 估算空间索引统计信息
func (*SpatialIndexSupport) ExtractSpatialFunction ¶
func (sis *SpatialIndexSupport) ExtractSpatialFunction(expr string) (string, []string)
ExtractSpatialFunction 提取空间函数及其参数
func (*SpatialIndexSupport) ExtractSpatialIndexCandidates ¶
func (sis *SpatialIndexSupport) ExtractSpatialIndexCandidates( tableName string, expression string, columnTypes map[string]string, ) []*IndexCandidate
ExtractSpatialIndexCandidates 从表达式中提取空间索引候选
func (*SpatialIndexSupport) GetSpatialIndexDDL ¶
func (sis *SpatialIndexSupport) GetSpatialIndexDDL( tableName string, columnName string, indexName string, ) string
GetSpatialIndexDDL 生成创建空间索引的 DDL
func (*SpatialIndexSupport) GetSpatialIndexSubType ¶
func (sis *SpatialIndexSupport) GetSpatialIndexSubType(columnType string) string
GetSpatialIndexSubType 获取空间索引的具体子类型
func (*SpatialIndexSupport) IsColumnTypeCompatible ¶
func (sis *SpatialIndexSupport) IsColumnTypeCompatible(columnType string) bool
IsColumnTypeCompatible 检查列类型是否支持空间索引
func (*SpatialIndexSupport) IsSpatialExpression ¶
func (sis *SpatialIndexSupport) IsSpatialExpression(expr string) bool
IsSpatialExpression 检查表达式是否为空间索引相关表达式
func (*SpatialIndexSupport) OptimizeSpatialQuery ¶
func (sis *SpatialIndexSupport) OptimizeSpatialQuery( query string, tables map[string]bool, ) []string
OptimizeSpatialQuery 优化空间查询建议
func (*SpatialIndexSupport) ValidateSpatialFunction ¶
func (sis *SpatialIndexSupport) ValidateSpatialFunction(funcName string, args []string) error
ValidateSpatialFunction 验证空间函数的有效性
type Statistics ¶
Statistics 统计信息(简化版)
type StatisticsCollector ¶
type StatisticsCollector interface {
CollectStatistics(ctx context.Context, tableName string) (*TableStatistics, error)
}
StatisticsCollector 基础统计收集器接口
type StatisticsIntegrator ¶
type StatisticsIntegrator struct {
// contains filtered or unexported fields
}
StatisticsIntegrator 统计信息集成器 用于将真实统计信息与虚拟索引统计信息集成
func NewStatisticsIntegrator ¶
func NewStatisticsIntegrator(estimator statistics.CardinalityEstimator) *StatisticsIntegrator
NewStatisticsIntegrator 创建统计信息集成器
func (*StatisticsIntegrator) ClearCache ¶
func (si *StatisticsIntegrator) ClearCache()
ClearCache 清理缓存
func (*StatisticsIntegrator) EstimateCorrelationFromRealStats ¶
func (si *StatisticsIntegrator) EstimateCorrelationFromRealStats(tableName string, columns []string) (float64, error)
EstimateCorrelationFromRealStats 从真实统计信息估算列相关性
func (*StatisticsIntegrator) EstimateIndexSizeFromRealStats ¶
func (si *StatisticsIntegrator) EstimateIndexSizeFromRealStats(tableName string, columns []string) (int64, error)
EstimateIndexSizeFromRealStats 从真实统计信息估算索引大小
func (*StatisticsIntegrator) EstimateNDVFromRealStats ¶
func (si *StatisticsIntegrator) EstimateNDVFromRealStats(tableName, columnName string) (float64, error)
EstimateNDVFromRealStats 从真实统计信息估算 NDV
func (*StatisticsIntegrator) EstimateNDVFromRealStatsMultiColumn ¶
func (si *StatisticsIntegrator) EstimateNDVFromRealStatsMultiColumn(tableName string, columns []string) (float64, error)
EstimateNDVFromRealStatsMultiColumn 从真实统计信息估算多列的 NDV
func (*StatisticsIntegrator) EstimateNullFractionFromRealStats ¶
func (si *StatisticsIntegrator) EstimateNullFractionFromRealStats(tableName, columnName string) (float64, error)
EstimateNullFractionFromRealStats 从真实统计信息估算 NULL 比例
func (*StatisticsIntegrator) EstimateSelectivityFromRealStats ¶
func (si *StatisticsIntegrator) EstimateSelectivityFromRealStats(tableName, columnName string, filter interface{}) (float64, error)
EstimateSelectivityFromRealStats 从真实统计信息估算选择性
func (*StatisticsIntegrator) GenerateIndexStatsFromRealStats ¶
func (si *StatisticsIntegrator) GenerateIndexStatsFromRealStats( tableName string, columns []string, isUnique bool, ) (*HypotheticalIndexStats, error)
GenerateIndexStatsFromRealStats 从真实统计信息生成虚拟索引统计
func (*StatisticsIntegrator) GetHistogram ¶
func (si *StatisticsIntegrator) GetHistogram(tableName, columnName string) (*statistics.Histogram, error)
GetHistogram 获取列的直方图
func (*StatisticsIntegrator) GetRealStatistics ¶
func (si *StatisticsIntegrator) GetRealStatistics(tableName string) (*statistics.TableStatistics, error)
GetRealStatistics 获取表的真实统计信息
func (*StatisticsIntegrator) GetStatisticsSummary ¶
func (si *StatisticsIntegrator) GetStatisticsSummary(tableName string) string
GetStatisticsSummary 获取统计信息摘要(用于调试)
type SubqueryFlatteningRule ¶
type SubqueryFlatteningRule struct{}
SubqueryFlatteningRule flattens subqueries into joins Patterns: IN (SELECT ...) -> JOIN, EXISTS (SELECT ...) -> JOIN
func NewSubqueryFlatteningRule ¶
func NewSubqueryFlatteningRule() *SubqueryFlatteningRule
NewSubqueryFlatteningRule creates a new subquery flattening rule
func (*SubqueryFlatteningRule) Apply ¶
func (r *SubqueryFlatteningRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the subquery flattening rule
func (*SubqueryFlatteningRule) Match ¶
func (r *SubqueryFlatteningRule) Match(plan LogicalPlan) bool
Match checks if plan contains flatten-able subqueries
func (*SubqueryFlatteningRule) Name ¶
func (r *SubqueryFlatteningRule) Name() string
Name returns rule name
type SubqueryMaterializationRule ¶
type SubqueryMaterializationRule struct {
// contains filtered or unexported fields
}
SubqueryMaterializationRule materializes repeated subqueries Avoids executing the same subquery multiple times
func NewSubqueryMaterializationRule ¶
func NewSubqueryMaterializationRule() *SubqueryMaterializationRule
NewSubqueryMaterializationRule creates a new subquery materialization rule
func (*SubqueryMaterializationRule) Apply ¶
func (r *SubqueryMaterializationRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the subquery materialization rule
func (*SubqueryMaterializationRule) Match ¶
func (r *SubqueryMaterializationRule) Match(plan LogicalPlan) bool
Match checks if plan contains subqueries
func (*SubqueryMaterializationRule) Name ¶
func (r *SubqueryMaterializationRule) Name() string
Name returns rule name
type SystemViews ¶
type SystemViews struct {
// contains filtered or unexported fields
}
SystemViews 系统视图管理器
func (*SystemViews) AddHypotheticalIndex ¶
func (sv *SystemViews) AddHypotheticalIndex(index HypotheticalIndexDisplay)
AddHypotheticalIndex 添加虚拟索引
func (*SystemViews) AddIndexAdvisorResult ¶
func (sv *SystemViews) AddIndexAdvisorResult(result IndexAdvisorResult)
AddIndexAdvisorResult 添加索引推荐结果
func (*SystemViews) AddUnusedIndex ¶
func (sv *SystemViews) AddUnusedIndex(index UnusedIndex)
AddUnusedIndex 添加未使用的索引
func (*SystemViews) ClearHypotheticalIndexes ¶
func (sv *SystemViews) ClearHypotheticalIndexes()
ClearHypotheticalIndexes 清空虚拟索引列表
func (*SystemViews) ClearIndexAdvisorResults ¶
func (sv *SystemViews) ClearIndexAdvisorResults()
ClearIndexAdvisorResults 清空索引推荐结果
func (*SystemViews) ClearUnusedIndexes ¶
func (sv *SystemViews) ClearUnusedIndexes()
ClearUnusedIndexes 清空未使用的索引列表
func (*SystemViews) ConvertRecommendationsToSystemViews ¶
func (sv *SystemViews) ConvertRecommendationsToSystemViews( recommendations []*IndexRecommendation, database string, ) []IndexAdvisorResult
ConvertRecommendationsToSystemViews 将推荐结果转换为系统视图格式
func (*SystemViews) GetHypotheticalIndexes ¶
func (sv *SystemViews) GetHypotheticalIndexes() []HypotheticalIndexDisplay
GetHypotheticalIndexes 获取虚拟索引列表
func (*SystemViews) GetHypotheticalIndexesForTable ¶
func (sv *SystemViews) GetHypotheticalIndexesForTable(tableName string) []HypotheticalIndexDisplay
GetHypotheticalIndexesForTable 获取指定表的虚拟索引
func (*SystemViews) GetIndexAdvisorResults ¶
func (sv *SystemViews) GetIndexAdvisorResults() []IndexAdvisorResult
GetIndexAdvisorResults 获取索引推荐结果
func (*SystemViews) GetIndexAdvisorResultsForTable ¶
func (sv *SystemViews) GetIndexAdvisorResultsForTable(tableName string) []IndexAdvisorResult
GetIndexAdvisorResultsForTable 获取指定表的索引推荐结果
func (*SystemViews) GetMaxResults ¶
func (sv *SystemViews) GetMaxResults() int
GetMaxResults 获取最大结果数量
func (*SystemViews) GetStatistics ¶
func (sv *SystemViews) GetStatistics() map[string]int
GetStatistics 获取统计信息
func (*SystemViews) GetTopRecommendedIndexes ¶
func (sv *SystemViews) GetTopRecommendedIndexes(limit int) []IndexAdvisorResult
GetTopRecommendedIndexes 获取推荐索引排行
func (*SystemViews) GetUnusedIndexes ¶
func (sv *SystemViews) GetUnusedIndexes() []UnusedIndex
GetUnusedIndexes 获取未使用的索引列表
func (*SystemViews) GetUnusedIndexesForTable ¶
func (sv *SystemViews) GetUnusedIndexesForTable(tableName string) []UnusedIndex
GetUnusedIndexesForTable 获取指定表的未使用索引
func (*SystemViews) HypotheticalIndexDisplayToRow ¶
func (sv *SystemViews) HypotheticalIndexDisplayToRow(index HypotheticalIndexDisplay) []interface{}
HypotheticalIndexDisplayToRow 将虚拟索引转换为行数据
func (*SystemViews) IndexAdvisorResultToRow ¶
func (sv *SystemViews) IndexAdvisorResultToRow(result IndexAdvisorResult) []interface{}
IndexAdvisorResultToRow 将索引推荐结果转换为行数据(用于信息模式视图)
func (*SystemViews) QueryIndexAdvisorResults ¶
func (sv *SystemViews) QueryIndexAdvisorResults(filter map[string]interface{}) []IndexAdvisorResult
QueryIndexAdvisorResults 查询索引推荐结果(模拟信息模式查询)
func (*SystemViews) SetMaxResults ¶
func (sv *SystemViews) SetMaxResults(max int)
SetMaxResults 设置最大结果数量
func (*SystemViews) UnusedIndexToRow ¶
func (sv *SystemViews) UnusedIndexToRow(index UnusedIndex) []interface{}
UnusedIndexToRow 将未使用索引转换为行数据
type TableProfile ¶
type TableProfile struct {
TableName string
RowCount int64
IsHot bool // 是否为热表
IsStatic bool // 是否为静态表
AccessFrequency float64 // 访问频率
UpdateFrequency float64 // 更新频率
LastProfileTime time.Time
SuggestedInterval time.Duration // 建议的收集间隔
}
TableProfile 表配置文件
type TableStatistics ¶
type TableStatistics struct {
Name string
RowCount int64
ColumnStats map[string]*ColumnStatistics
}
TableStatistics 表统计信息
func CollectStatistics ¶
func CollectStatistics(dataSource domain.DataSource, tableName string) (*TableStatistics, error)
CollectStatistics 从数据源收集统计信息(简化版)
type TableTrigger ¶
type TableTrigger struct {
TableName string
LastRefreshTime time.Time
TotalWrites int64 // 累计写入量
PendingRefresh bool // 是否有待处理的刷新
WriteHistory []WriteRecord // 写入历史
}
TableTrigger 表触发器
type TableTriggerStats ¶
type TableTriggerStats struct {
TableName string
LastRefreshTime time.Time
TotalWrites int64
PendingRefresh bool
DeltaBufferSize int64
}
TableTriggerStats 表触发器统计信息
type TopNInfo ¶
type TopNInfo struct {
SortItems []*parser.OrderItem // Sort items
Limit int64 // Limit count
Offset int64 // Offset count
}
TopNInfo contains TopN pushdown information
type TopNPushDownRule ¶
type TopNPushDownRule struct{}
TopNPushDownRule pushes TopN down to data source
func NewTopNPushDownRule ¶
func NewTopNPushDownRule() *TopNPushDownRule
NewTopNPushDownRule creates a new TopN pushdown rule
func (*TopNPushDownRule) Apply ¶
func (r *TopNPushDownRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply applies the TopN pushdown rule
func (*TopNPushDownRule) Match ¶
func (r *TopNPushDownRule) Match(plan LogicalPlan) bool
Match checks if the rule matches a TopN node
type UnusedIndex ¶
type UnusedIndex struct {
Database string
TableName string
IndexName string
IndexColumns []string
LastUsedAt time.Time
IndexSize int64
Reason string
}
UnusedIndex 未使用的索引
type VectorIndexRule ¶
type VectorIndexRule struct {
// contains filtered or unexported fields
}
VectorIndexRule 向量索引优化规则 将 Sort + Limit + 向量距离函数 转换为 VectorScan
func (*VectorIndexRule) Apply ¶
func (r *VectorIndexRule) Apply(ctx context.Context, plan LogicalPlan, optCtx *OptimizationContext) (LogicalPlan, error)
Apply 应用向量索引优化规则
func (*VectorIndexRule) Match ¶
func (r *VectorIndexRule) Match(plan LogicalPlan) bool
Match 检查规则是否匹配 匹配条件: 1. 有 ORDER BY 子句且包含向量距离函数 2. 有 LIMIT 子句 3. 表上有对应的向量索引
type VectorSearchInfo ¶
VectorSearchInfo 向量搜索信息
type ViewExecutor ¶
type ViewExecutor struct {
// contains filtered or unexported fields
}
ViewExecutor handles view execution (TEMPTABLE algorithm)
func NewViewExecutor ¶
func NewViewExecutor(dataSource domain.DataSource) *ViewExecutor
NewViewExecutor creates a new view executor
func (*ViewExecutor) ExecuteAsTempTable ¶
func (ve *ViewExecutor) ExecuteAsTempTable(ctx context.Context, viewInfo *domain.ViewInfo, outerQuery *parser.SelectStatement) (*domain.QueryResult, error)
ExecuteAsTempTable executes a view query and stores result in a temporary table
type ViewRewriter ¶
type ViewRewriter struct {
// contains filtered or unexported fields
}
ViewRewriter handles view query rewriting using the MERGE algorithm
func NewViewRewriter ¶
func NewViewRewriter() *ViewRewriter
NewViewRewriter creates a new view rewriter
func (*ViewRewriter) Rewrite ¶
func (vr *ViewRewriter) Rewrite(outerQuery *parser.SelectStatement, viewInfo *domain.ViewInfo) (*parser.SelectStatement, error)
Rewrite merges outer query with view definition using MERGE algorithm
type WindowFunctionDef ¶
type WindowFunctionDef struct {
Expr *parser.WindowExpression
ResultCol string // 结果列名
}
WindowFunctionDef 窗口函数定义
type WindowFunctionItem ¶
type WindowFunctionItem struct {
Func *parser.Expression
Spec *parser.WindowSpec
OrderBy []*parser.OrderItem
PartitionBy []*parser.Expression
}
WindowFunctionItem represents a window function with its specification
type WindowOperator ¶
type WindowOperator struct {
// contains filtered or unexported fields
}
WindowOperator 窗口函数执行算子
func NewWindowOperator ¶
func NewWindowOperator(child PhysicalPlan, windowFuncs []*parser.WindowExpression) *WindowOperator
NewWindowOperator 创建窗口函数算子
func (*WindowOperator) Execute ¶
func (op *WindowOperator) Execute(ctx context.Context) (*domain.QueryResult, error)
Execute 执行窗口函数 DEPRECATED: 执行逻辑已迁移到 pkg/executor 包,此方法保留仅为兼容性
type WriteRecord ¶
type WriteRecord struct {
Operation string // INSERT, UPDATE, DELETE
RowCount int64
Timestamp time.Time
}
WriteRecord 写入记录
type WriteTriggerDataSource ¶
type WriteTriggerDataSource struct {
// contains filtered or unexported fields
}
WriteTriggerDataSource 带写入触发器的数据源包装器 自动监控写入操作并触发统计信息刷新
func NewWriteTriggerDataSource ¶
func NewWriteTriggerDataSource(base domain.DataSource, trigger *WriteTriggerManager) *WriteTriggerDataSource
NewWriteTriggerDataSource 创建带写入触发器的数据源
func (*WriteTriggerDataSource) Execute ¶
func (wtds *WriteTriggerDataSource) Execute(ctx context.Context, sql string) (*domain.QueryResult, error)
Execute 执行SQL语句(监控DML操作)
func (*WriteTriggerDataSource) Query ¶
func (wtds *WriteTriggerDataSource) Query(ctx context.Context, query string, options *domain.QueryOptions) (*domain.QueryResult, error)
Query 执行查询
type WriteTriggerManager ¶
type WriteTriggerManager struct {
// contains filtered or unexported fields
}
WriteTriggerManager 写入触发器管理器 监控表写入操作,自动触发统计信息刷新
func NewWriteTriggerManager ¶
func NewWriteTriggerManager(collector *IncrementalStatisticsCollector, threshold int64, workers int) *WriteTriggerManager
NewWriteTriggerManager 创建写入触发器管理器
func (*WriteTriggerManager) Explain ¶
func (wtm *WriteTriggerManager) Explain() string
Explain 解释触发器管理器
func (*WriteTriggerManager) ForceRefresh ¶
func (wtm *WriteTriggerManager) ForceRefresh(tableName string) error
ForceRefresh 强制刷新指定表的统计信息
func (*WriteTriggerManager) GetAllStats ¶
func (wtm *WriteTriggerManager) GetAllStats() map[string]*TableTriggerStats
GetAllStats 获取所有表的统计信息
func (*WriteTriggerManager) GetWriteStats ¶
func (wtm *WriteTriggerManager) GetWriteStats(tableName string) *TableTriggerStats
GetWriteStats 获取写入统计信息
func (*WriteTriggerManager) OnWrite ¶
func (wtm *WriteTriggerManager) OnWrite(tableName string, operation string, rowCount int64)
OnWrite 写入事件回调
func (*WriteTriggerManager) RefreshAll ¶
func (wtm *WriteTriggerManager) RefreshAll() error
RefreshAll 刷新所有注册表的统计信息
func (*WriteTriggerManager) RegisterTable ¶
func (wtm *WriteTriggerManager) RegisterTable(tableName string)
RegisterTable 注册表到触发器系统
func (*WriteTriggerManager) SetRefreshInterval ¶
func (wtm *WriteTriggerManager) SetRefreshInterval(interval time.Duration)
SetRefreshInterval 设置刷新间隔
func (*WriteTriggerManager) SetTriggerThreshold ¶
func (wtm *WriteTriggerManager) SetTriggerThreshold(threshold int64)
SetTriggerThreshold 设置触发阈值
func (*WriteTriggerManager) UnregisterTable ¶
func (wtm *WriteTriggerManager) UnregisterTable(tableName string)
UnregisterTable 注销表
Source Files
¶
- cardinality.go
- debug.go
- decorrelate.go
- derive_topn_from_window.go
- enhanced_cardinality.go
- enhanced_column_pruning.go
- enhanced_optimizer.go
- enhanced_predicate_pushdown.go
- executor_util.go
- explain.go
- expression_evaluator.go
- expression_executor.go
- expression_util.go
- filter_converter.go
- filterable_util.go
- fulltext_index_support.go
- genetic_algorithm.go
- hint_agg.go
- hint_index.go
- hint_join.go
- hint_orderby.go
- hint_subquery.go
- hypothetical_index_store.go
- hypothetical_stats.go
- incremental_stats.go
- index_advisor.go
- index_candidate_extractor.go
- index_cost_estimator.go
- index_merger.go
- join_elimination.go
- join_reorder.go
- logical_aggregate.go
- logical_aggregate_hints.go
- logical_apply.go
- logical_datasource.go
- logical_datasource_hints.go
- logical_delete.go
- logical_insert.go
- logical_join.go
- logical_limit.go
- logical_projection.go
- logical_scan_accessors.go
- logical_selection.go
- logical_sort.go
- logical_topn.go
- logical_union.go
- logical_update.go
- logical_window.go
- maxmin_elimination.go
- merge_join.go
- optimized_aggregate.go
- optimized_executor.go
- optimized_parallel.go
- optimizer.go
- or_to_union.go
- performance.go
- physical_scan.go
- physical_sort.go
- plan_cache.go
- plan_converter.go
- procedure_executor.go
- rules.go
- rules_vector.go
- semi_join_rewrite.go
- show_executor.go
- show_processor.go
- spatial_index_support.go
- statistics_integration.go
- subquery_flattening.go
- subquery_materialization.go
- system_views.go
- topn_pushdown.go
- types.go
- utils.go
- variable_manager.go
- view_executor.go
- view_rewrite.go
- window_operator.go
- write_trigger.go