SequoiaDB giant sequoia database-operations in the access plan

The access plan contains several specific operations, and their meanings and information contained are different.

COORD-MERGE operation

In the detailed access plan, the COORD-MERGE object corresponds to a query context object on the coordination node, and the information displayed is as follows:

Field name Types of description
Operator String The name of the operator: "COORD-MERGE"
Sort String COORD-MERGE needs to ensure that the output results are sorted in order
NeedReorder Boolean Does COORD-MERGE need to sort and merge records of multiple data groups according to the sort field? NeedReorder is true when the query contains sorting
DataNodeNum Integer COORD-MERGE The number of data nodes involved in the query
DataNodeList Array COORD-MERGE involves query data nodes, listed in the order of query execution
DataNodeList.Name String COORD-MERGE send query data node name
DataNodeList.EstTotalCost Floating point The estimated time (unit: seconds) for the query sent by COORD-MERGE to query on the data node
DataNodeList.QueryTimeSpent Floating point The execution time of the query on the data node (unit: second), displayed when the Run option is true
DataNodeList.WaitTimeSpent Floating point The waiting time (unit: second) for the query sent by COORD-MERGE on the data node, displayed when the Run option is true
Selector BSON object The selector executed by COORD-MERGE
Skip Long integer Specify the number of records that COORD-MERGE needs to skip
Return Long integer Specify the maximum number of records returned by COORD-MERGE
Estimate BSON object Estimated COORD-MERGE cost information, displayed when the Estimate option is true
Estimate.StartCost Floating point Estimated startup time of COORD-MERGE (unit: second)
Estimate.RunCost Floating point Estimated running time of COORD-MERGE (unit: second)
Estimate.TotalCost Floating point Estimated end time of COORD-MERGE (unit: second)
Estimate.Output BSON object Estimated statistics of COORD-MERGE output results, displayed when the Filter option contains "Output"
Estimate.Output.Records Long integer Estimated number of records output by COORD-MERGE
Estimate.Output.RecordSize Integer Estimated average number of bytes of records output by COORD-MERGE
Estimate.Output.Sorted Boolean COORD-MERGE output results are in order
Run BSON object The cost information of the actual execution of COORD-MERGE, displayed when the Run option is true
Run.ContextID Long integer COORD-MERGE execution context ID
Run.StartTimestamp String COORD-MERGE execution start timestamp
Run.QueryTimeSpent Floating point COORD-MERGE execution time (unit: second)
Run.GetMores Long integer The number of requests COORD-MERGE to return the result set
Run.ReturnNum Long integer COORD-MERGE returns the number of records
Run.WaitTimeSpent Floating point COORD-MERGE waits for the data return time (unit: seconds, rough statistics in seconds)
ChildOperators Array COORD-MERGE sub-operations (the access plan results of the query returned by each data group), please refer to: the access plan of the main table or the access plan of the data node for details

Example:

{
  ...,
  "PlanPath": {
    "Operator": "COORD-MERGE",
    "Sort": {},
    "NeedReorder": false,
    "DataNodeNum": 2,
    "DataNodeList": [
      {
        "Name": "hostname:11820",
        "EstTotalCost": 0.4750005,
        "QueryTimeSpent": 0.045813,
        "WaitTimeSpent": 0.000124
      },
      {
        "Name": "hostname:11830",
        "EstTotalCost": 0.4750005,
        "QueryTimeSpent": 0.045841,
        "WaitTimeSpent": 0.000108
      }
    ],
    "Selector": {},
    "Skip": 0,
    "Return": -1,
    "Estimate": {
      "StartCost": 0,
      "RunCost": 0.4750015,
      "TotalCost": 0.4750015,
      "Output": {
        "Records": 2,
        "RecordSize": 43,
        "Sorted": false
      }
    },
    "Run": {
      "ContextID": 9,
      "StartTimestamp": "2017-12-09-13.51.14.749863",
      "QueryTimeSpent": 0.046311,
      "GetMores": 3,
      "ReturnNum": 10,
      "WaitTimeSpent": 0
    },
    "ChildOperators": [
      {
        ...
      },
      {
        ...
      }
    ]
  }
}

Copy

MERGE operation

In the detailed access plan, the MERGE object corresponds to the main table query context object on a data node, and the information displayed is as follows:

Field name Types of description
Operator String The name of the operator: "MERGE"
Sort String MERGE needs to ensure that the output results are sorted in order
NeedReorder Boolean Does MERGE need to sort and merge the records of multiple sub-tables according to the sorting field? True when the query contains sorting and the sorting field does not contain the partition key of the main table
SubCollectionNum Integer MERGE involves the number of query subtables
SubCollectionList 数组 MERGE 涉及查询的子表,按查询的执行顺序列出
SubCollectionList.Name 字符串 MERGE 发送查询的子表名称
SubCollectionList.EstTotalCost 浮点数 MERGE 发送的查询在子表上查询的估算时间(单位:秒)
SubCollectionList.QueryTimeSpent 浮点数 MERGE 发送的查询在子表上查询的执行时间(单位:秒),Run 选项为 true 时显示
SubCollectionList.WaitTimeSpent 浮点数 MERGE 发送的查询在数据节点上查询的等待时间(单位:秒),Run 选项为 true 时显示)
Selector BSON 对象 MERGE 执行的选择符
Skip 长整型 指定 MERGE 需要跳过的记录个数
Return 长整型 指定 MERGE 最多返回的记录个数
Estimate BSON 对象 估算的 MERGE 代价信息,Estimate 选项为 true 时显示
Estimate.StartCost 浮点型 估算的 MERGE 的启动时间(单位:秒)
Estimate.RunCost 浮点型 估算的 MERGE 的运行时间(单位:秒)
Estimate.TotalCost 浮点型 估算的 MERGE 的结束时间(单位:秒)
Estimate.Output BSON 对象 估算的 MERGE 输出结果的统计信息,Filter 选项包含 "Output" 时显示
Estimate.Output.Records 长整型 估算的 MERGE 输出的记录个数
Estimate.Output.RecordSize 整型 估算的 MERGE 输出的记录平均字节数
Estimate.Output.Sorted 布尔型 MERGE 输出结果是否有序
Run BSON 对象 实际执行 MERGE 的代价信息,Run 选项为 true 时显示
Run.ContextID 长整型 MERGE 执行的上下文 ID
Run.StartTimestamp 字符串 MERGE 执行启动的时间戳
Run.QueryTimeSpent 浮点型 MERGE 执行耗时(单位:秒)
Run.GetMores 长整型 请求 MERGE 返回结果集的次数
Run.ReturnNum 长整型 MERGE 返回记录个数
SubCollections 数组 MERGE 的子操作(每个子表返回的查询的访问计划结果),详细请参考:数据节点的访问计划

示例:

{
  ...,
  "PlanPath": {
    "Operator": "MERGE",
    "Sort": {
      "h": 1
    },
    "NeedReorder": true,
    "SubCollectionNum": 2,
    "SubCollectionList": [
      {
        "Name": "subcs.subcl1",
        "EstTotalCost": 0.8277414999999999,
        "QueryTimeSpent": 1.080046,
        "WaitTimeSpant": 0.000234
      },
      {
        "Name": "subcs.subcl2",
        "EstTotalCost": 0.8277414999999999,
        "QueryTimeSpent": 0.946832,
        "WaitTimeSpant": 0.000182
      }
    ],
    "Selector": {},
    "Skip": 0,
    "Return": -1,
    "Estimate": {
      "StartCost": 1.630483,
      "RunCost": 0.09999999999999999,
      "TotalCost": 1.730483,
      "Output": {
        "Records": 50000,
        "RecordSize": 43,
        "Sorted": true
      }
    },
    "Run": {
      "ContextID": 63121,
      "StartTimestamp": "2017-12-11-16.18.00.789234",
      "QueryTimeSpent": 1.203218,
      "GetMores": 3,
      "ReturnNum": 50000
    },
    "SubCollections": [
      {
        ...
      },
      {
        ...
      }
    ]
  }
}

Copy

SORT 操作

详细的访问计划中,SORT 对象对应一个数据节点上的排序上下文对象,其中展示的信息如下:

字段名 类型 描述
Operator 字符串 操作符的名称: "SORT"
Sort BSON 对象 SORT 执行的排序字段
Selector BSON 对象 SORT 执行的选择符
Skip 长整型 指定 SORT 需要跳过的记录个数
Return 长整型 指定 SORT 最多返回的记录个数
Estimate BSON 对象 估算的 SORT 代价信息,Estimate 选项为 true 时显示
Estimate.StartCost 浮点型 估算的 SORT 的启动时间(单位:秒)
Estimate.RunCost 浮点型 估算的 SORT 的运行时间(单位:秒)
Estimate.TotalCost 浮点型 估算的 SORT 的结束时间(单位:秒)
Estimate.SortType 字符串 SORT 估算的排序类型:1. "InMemory" 为内存排序;2. "External" 为外存排序
Estimate.Output BSON 对象 估算的 SORT 输出的统计信息,Filter 选项包含 "Output" 时显示
Estimate.Output.Records 长整型 估算的 SORT 输出的记录个数
Estimate.Output.RecordSize 整型 估算的 SORT 输出的记录平均字节数
Estimate.Output.Sorted 布尔型 SORT 输出是否有序,对 SORT 为 true
Run BSON 对象 实际查询的 SORT 代价信息,Run 选项为 true 时显示
Run.ContextID 长整型 SORT 执行的上下文 ID
Run.StartTimestamp 字符串 SORT 启动的时间
Run.QueryTimeSpent 浮点型 SORT 耗时(单位:秒)
Run.GetMores 长整型 请求 SORT 返回结果集的次数
Run.ReturnNum 长整型 SORT 返回记录个数
Run.SortType 字符串 SORT 执行的排序类型: 1. "InMemory" 为内存排序; 2. "External" 为外存排序
ChildOperators 数组 SORT 的子操作(TBSCAN 或 IXSCAN)

示例:

{
  ...,
  "PlanPath": {
    "Operator": "SORT",
    "Sort": {
      "c": 1
    },
    "Selector": {},
    "Skip": 0,
    "Return": -1,
    "Estimate": {
      "StartCost": 0.475,
      "RunCost": 5e-7,
      "TotalCost": 0.4750005,
      "SortType": "InMemory",
      "Output": {
        "Records": 1,
        "RecordSize": 43,
        "Sorted": true
      }
    },
    "Run": {
      "ContextID": 8,
      "StartTimestamp": "2017-11-29-14.02.38.108504",
      "QueryTimeSpent": 0.050564,
      "GetMores": 1,
      "ReturnNum": 5,
      "SortType": "InMemory"
    },
    "ChildOperators": [
      {
        ...
      }
    ]
  }
}

Copy

TBSCAN 操作

详细的访问计划中,TBSCAN 对应一个使用全表扫描的上下文对象,展示的信息如下:

字段名 类型 描述
Operator 字符串 操作符的名称: "TBSCAN"
Collection 字符串 TBSCAN 访问的集合名字
Query BSON 对象 TBSCAN 执行的匹配符
Selector BSON 对象 TBSCAN 执行的选择符
Skip 长整型 指定 TBSCAN 需要跳过的记录个数
Return 长整型 指定 TBSCAN 最多返回的记录个数
Estimate BSON 对象 估算的 TBSCAN 代价信息,Estimate 选项为 true 时显示
Estimate.StartCost 浮点型 估算的 TBSCAN 的启动时间(单位:秒)
Estimate.RunCost 浮点型 估算的 TBSCAN 的运行时间(单位:秒)
Estimate.TotalCost 浮点型 估算的 TBSCAN 的结束时间(单位:秒)
Estimate.CLEstFromStat 布尔型 TBSCAN 是否使用集合的统计信息进行估算
Estimate.CLStatTime 字符串 TBSCAN 使用的集合的统计信息的生成时间
Estimate.Input BSON 对象 估算的 TBSCAN 输入的统计信息,Filter 选项包含 "Input" 时显示
Estimate.Input.Pages 长整型 估算的 TBSCAN 输入的数据页数
Estimate.Input.Records 长整型 估算的 TBSCAN 输入的记录个数
Estimate.Input.RecordSize 整型 估算的 TBSCAN 输入的记录平均字节数
Estimate.Filter BSON 对象 估算的 TBSCAN 进行过滤的信息,Filter 选项包含 "Filter" 时显示
Estimate.Filter.MthSelectivity 浮点型 估算的 TBSCAN 使用匹配符进行过滤的选择率
Estimate.Output BSON 对象 估算的 TBSCAN 输出的统计信息,Filter 选项包含 "Output" 时显示
Estimate.Output.Records 长整型 估算的 TBSCAN 输出的记录个数
Estimate.Output.RecordSize 整型 估算的 TBSCAN 输出的记录平均字节数
Estimate.Output.Sorted 布尔型 TBSCAN 输出是否有序,对 TBSCAN 为 false
Run BSON 对象 实际执行 TBSCAN 的代价信息,Run 选项为 true 时显示
Run.ContextID 长整型 TBSCAN 执行的上下文标识
Run.StartTimestamp 字符串 TBSCAN 执行启动的时间戳
Run.QueryTimeSpent 浮点型 TBSCAN 执行耗时(单位:秒)
Run.GetMores 长整型 请求 TBSCAN 返回结果集的次数
Run.ReturnNum 长整型 TBSCAN 返回记录个数
Run.ReadRecords 长整型 TBSCAN 扫描记录个数

示例:

{
  ...,
  "PlanPath": {
    "Operator": "TBSCAN",
    "Collection": "sample.employee",
    "Query": {
      "$and": []
    },
    "Selector": {},
    "Skip": 0,
    "Return": -1,
    "Estimate": {
      "StartCost": 0,
      "RunCost": 0.45,
      "TotalCost": 0.45,
      "CLEstFromStat": false,
      "Input": {
        "Pages": 25,
        "Records": 25000,
        "RecordSize": 43
      },
      "Filter": {
        "MthSelectivity": 1
      },
      "Output": {
        "Records": 25000,
        "RecordSize": 43,
        "Sorted": false
      }
    },
    "Run": {
      "ContextID": 63123,
      "StartTimestamp": "2017-12-11-16.18.00.789831",
      "QueryTimeSpent": 0.040438,
      "GetMores": 25,
      "ReturnNum": 25000,
      "ReadRecords": 25000
    }
  }
}

Copy

IXSCAN 操作

详细的访问计划中,IXSCAN 对应一个使用索引扫描的上下文对象,展示的信息如下:

字段名 类型 描述
Operator 字符串 操作符的名称: "IXSCAN"
Collection 字符串 IXSCAN 访问集合的名字
Index 字符串 IXSCAN 访问索引的名字
IXBound BSON 对象 IXSCAN 访问索引的查找范围
Query BSON 对象 IXSCAN 执行的匹配符
NeedMatch 布尔型 IXSCAN 是否需要在数据上执行匹配符进行过滤
Selector BSON 对象 IXSCAN 执行的选择符
Skip 长整型 指定 IXSCAN 需要跳过的记录个数
Return 长整型 指定 IXSCAN 最多返回的记录个数
Estimate BSON 对象 估算的 IXSCAN 代价信息,Estimate 选项为 true 时显示
Estimate.StartCost 浮点型 估算的 IXSCAN 的启动时间(单位:秒)
Estimate.RunCost 浮点型 估算的 IXSCAN 的运行时间(单位:秒)
Estimate.TotalCost 浮点型 估算的 IXSCAN 的结束时间(单位:秒)
Estimate.CLEstFromStat 布尔型 IXSCAN 是否使用集合的统计信息进行估算
Estimate.CLStatTime 时间戳 IXSCAN 使用的集合的统计信息的生成时间
Estimate.IXEstFromStat 布尔型 IXSCAN 是否使用索引的统计信息进行估算
Estimate.IXStatTime 时间戳 IXSCAN 使用的索引的统计信息的生成时间
Estimate.Input BSON 对象 估算的 IXSCAN 输入的统计信息,Filter 选项包含 "Input" 时显示
Estimate.Input.Pages 长整型 估算的 IXSCAN 输入的数据页数
Estimate.Input.Records 长整型 估算的 IXSCAN 输入的记录个数
Estimate.Input.RecordSize 整型 估算的 IXSCAN 输入的记录平均字节数
Estimate.Input.IndexPages 整型 估算的 IXSCAN 输入的索引页数
Estimate.Filter BSON 对象 估算的 IXSCAN 进行过滤的信息,Filter 选项包含 "Filter" 时显示
Estimate.Filter.MthSelectivity 浮点型 估算的 IXSCAN 使用匹配符进行过滤的选择率
Estimate.Filter.IXScanSelectivity 浮点型 估算的 IXSCAN 使用索引时需要扫描索引的比例
Estimate.Filter.IXPredSelectivity 浮点型 估算的 IXSCAN 使用索引进行过滤的选择率
Estimate.Output BSON 对象 估算的 IXSCAN 输出的统计信息,Filter 选项包含 "Output" 时显示
Estimate.Output.Records 长整型 估算的 IXSCAN 输出的记录个数
Estimate.Output.RecordSize 整型 估算的 IXSCAN 输出的记录平均字节数
Estimate.Output.Sorted 布尔型 IXSCAN 输出是否有序,如果索引包含 Sort 的所有字段并且匹配顺序,该项为 true,否则为 false
Run BSON 对象 实际查询的 IXSCAN 代价信息,Run 选项为 true 时显示
Run.ContextID 长整型 IXSCAN 执行的上下文 ID
Run.StartTimestamp 字符串 IXSCAN 启动的时间
Run.QueryTimeSpent 浮点型 IXSCAN 耗时(单位:秒)
Run.GetMores 长整型 请求 IXSCAN 返回结果集的次数
Run.ReturnNum 长整型 IXSCAN 返回记录个数
Run.ReadRecords 长整型 IXSCAN 扫描数据记录个数
Run.IndexReadRecords 长整型 IXSCAN 扫描索引项个数

示例:

{
  ...,
  "PlanPath": {
    "Operator": "IXSCAN",
    "Collection": "sample.employee",
    "Index": "index",
    "IXBound": {
      "a": [
        [
          1,
          1
        ]
      ]
    },
    "Query": {
      "$and": [
        {
          "a": {
            "$et": 1
          }
        }
      ]
    },
    "NeedMatch": false,
    "Selector": {},
    "Skip": 0,
    "Return": -1,
    "Estimate": {
      "StartCost": 5e-7,
      "RunCost": 0.3200035,
      "TotalCost": 0.320004,
      "CLEstFromStat": false,
      "IXEstFromStat": false,
      "Input": {
        "Pages": 25,
        "Records": 25000,
        "RecordSize": 43,
        "IndexPages": 15
      },
      "Filter": {
        "MthSelectivity": 0.00004,
        "IXScanSelectivity": 0.00004,
        "IXPredSelectivity": 0.00004,
      },
      "Output": {
        "Records": 1,
        "RecordSize": 43,
        "Sorted": false
      }
    },
    "Run": {
      "ContextID": 36136,
      "StartTimestamp": "2017-12-11-16.11.34.518111",
      "QueryTimeSpent": 0.935198,
      "GetMores": 1,
      "ReturnNum": 5,
      "ReadRecords": 5,
      "IndexReadRecords": 6
    }
  }
}

更多信息请访问巨杉数据库官网

Guess you like

Origin blog.csdn.net/yanyanyanyanyanY/article/details/113118659