关于 SequoiaDB
快速入门
安装
基本操作
数据模型
SQL引擎
S3引擎
系统架构
数据库管理
连接器
驱动
参考手册
故障排除
SAC 管控中心
Web服务
版本信息
SORT 的推演公式将展示以下信息:
字段名 | 类型 | 描述 |
---|---|---|
Records | 长整型 | 估算的 SORT 输入的记录个数 |
SortFields | 整型 | SORT 进行排序的字段个数 |
RecordTotalSize | 长整型 | 估算的 SORT 输入的记录总大小 公式为: Records * RecordSize |
Pages | 整型 | 估算的 SORT 输入的记录页数(输入记录个数的总大小存放入 4K 页面中的页数) 公式为: max( 1, ceil( RecordTotalSize / PageUnit) ) |
SortType | 字符串 | SORT 估算的排序类型 RecordTotalSize 小于 sortbuff 时,"InMemory" 为内存排序 RecordTotalSize 大于 sortbuff 时,"External" 为外存排序 |
IOCost | 数组 | 估算的 SORT 的 IO 代价的公式及计算过程 SortType 为 "InMemory" 时不需要计算 各个数据页需要写出磁盘,并进行归并排序,假设归并排序中 75% 为顺序读,25% 为随机读 公式为: ceil( Pages * ( SeqWrtIOCostUnit + SeqReadIOCostUnit * 0.75 + RandomReadIOCostUnit * 0.25 ) ) |
CPUCost | 数组 | 估算的 SORT 的 CPU 代价的公式及计算过程 即各个记录进行排序的代价 公式为: ceil( 2 * OptrCPUCost * SortFields * max( 2, Records ) * log2( max( 2, Records ) ) ) |
StartCost | 数组 | 估算的 SORT 的启动代价 需要计算子操作的总代价和排序的代价 公式为: ChildTotalCost + IOCPURate * IOCost + CPUCost |
RunCost | 数组 | 估算的 SORT 的运行代价(内部表示) 即从排序缓存中提取各个记录的代价 公式为: OptrCPUCost * Records |
TotalCost | 数组 | 估算的 SORT 的总代价(内部表示) 公式为: StartCost + RunCost |
OutputRecords | 数组 | 估算的 SORT 的输出记录个数 公式为: Records |
示例
"SortNode": { "Records": 1000000, "SortFields": 1, "RecordTotalSize": [ "Records * RecordSize", "1000000 * 269", 269000000 ], "Pages": [ "max( 1, ceil( RecordTotalSize / PageUnit) )", "max( 1, ceil( 269000000 / 4096) )", 65674 ], "SortType": "External", "IOCost": [ "ceil( Pages * ( SeqWrtIOCostUnit + SeqReadIOCostUnit * 0.75 + RandomReadIOCostUnit * 0.25 ) )", "ceil( 65674 * ( 2 + 1 * 0.75 + 10 * 0.25 ) )", 344789 ], "CPUCost": [ "ceil( 2 * OptrCPUCost * SortFields * max( 2, Records ) * log2( max( 2, Records ) ) )", "ceil( 2 * 1 * 1 * max( 2, 1000000 ) * log2( max( 2, 1000000 ) ) )", 39863138 ], "StartCost": [ "ChildTotalCost + IOCPURate * IOCost + CPUCost", "160864000 + 2000 * 344789 + 39863138", 890305138 ], "RunCost": [ "OptrCPUCost * Records", "1 * 1000000", 1000000 ], "TotalCost": [ "StartCost + RunCost", "890305138 + 1000000", 891305138 ], "OutputRecords": [ "Records", "1000000", 1000000 ] }