performance

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 创建批量执行器

func (*BatchExecutor) Add

func (be *BatchExecutor) Add(item interface{}) error

Add 添加到批次

func (*BatchExecutor) Close

func (be *BatchExecutor) Close() error

Close 关闭批量执行器

func (*BatchExecutor) Flush

func (be *BatchExecutor) Flush() error

Flush 手动刷新

type Index

type Index struct {
	Name        string
	TableName   string
	Columns     []string
	Unique      bool
	Primary     bool
	Cardinality int64 // 基数(唯一值数量)
}

Index 索引定义

type IndexManager

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

IndexManager 索引管理器

func NewIndexManager

func NewIndexManager() *IndexManager

NewIndexManager 创建索引管理器

func (*IndexManager) AddIndex

func (im *IndexManager) AddIndex(index *Index)

AddIndex 添加索引

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 IndexStats

type IndexStats struct {
	Name          string
	HitCount      int64
	MissCount     int64
	AvgAccessTime time.Duration
	LastAccessed  time.Time
}

IndexStats 索引统计信息

type MemoryPool

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

MemoryPool 内存池(用于重用对象减少GC压力)

func NewMemoryPool

func NewMemoryPool() *MemoryPool

NewMemoryPool 创建内存池

func (*MemoryPool) GetPool

func (mp *MemoryPool) GetPool(key string) interface{}

GetPool 获取指定类型的池

func (*MemoryPool) SetPool

func (mp *MemoryPool) SetPool(key string, pool interface{})

SetPool 设置指定类型的池

type PerformanceOptimizer

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

PerformanceOptimizer 性能优化器

func NewPerformanceOptimizer

func NewPerformanceOptimizer() *PerformanceOptimizer

NewPerformanceOptimizer 创建性能优化器

func (*PerformanceOptimizer) OptimizeQuery

OptimizeQuery 优化查询

type PlanNode

type PlanNode struct {
	Plan     interface{} // LogicalPlan 在 optimizer 包中定义
	Cost     float64
	Priority int
	Index    int
}

PlanNode 计划节点

type PriorityQueue

type PriorityQueue []*PlanNode

PriorityQueue 优先队列(用于JOIN重排序等优化)

func NewPriorityQueue

func NewPriorityQueue() *PriorityQueue

NewPriorityQueue 创建优先队列

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

Len 实现 heap.Interface

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less 实现 heap.Interface

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop 实现 heap.Interface

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push 实现 heap.Interface

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

Swap 实现 heap.Interface

Jump to

Keyboard shortcuts

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