Starrocks中的 Query Profile以及explain analyze及trace命令中的区别

背景

本文基于Starrocks 3.5.5
现有公司因为业务的不同,可能会更加关系单个SQL 的RT,因为如果一个SQL的RT比较大的话,影响的就是这个业务,从而影响收入,所以对于这方面我们就比较关心,
而最近在基于Starrocks做计算存储引擎的时候,遇到了一些问题。时间上超过了2秒,因此需要分析一下对应SQL的指标。
最直接的就是开启 Query Profile,比如说做一下配置:

SET enable_profile = true;
SET global big_query_profile_threshold = '1s';
SET runtime_profile_report_interval = 30;

这个在对应的UI界面(http://<fe_ip>:<fe_http_port>)就能看到Profile
当然还有ANALYZE PROFILE,explain analyzetrace命令,这里就来分析一下三者的差别, 其中以以下SQL为例:

SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE SCHEMA_NAME = 'fin_config';

结论

  1. 开启Query Profile会得得到更多的明细信息,以及每个阶段所用的耗时,适合对该SQL的每个算子的各个指标全方位的分析
    此种方法会有BE端的信息更新过来,但是这个信息只存在内存,FE重启之后就不复存在。
  2. EXPLAIN ANALYZE 展示的是大概的查询执行计划执行信息,比如说 Summary和fragement
  3. ANALYZE PROFILE 展示的和explain analyze一样,但是指标比 explain analyze 更加丰富
  4. trace 展示的是某个局部指标,比如说 某个规则的耗时

对于每个方法所对应指标信息如下见下面的 其他

分析

开启Query Profile

通过访问http://<fe_ip>:<fe_http_port>/query_profile?query_id可以获取到对应的profile,
对应到Fe端是QueryProfileAction类接受请求:
QueryProfileAction 里有对应的 “/query_profile” Get请求

对应的Get方法response为executeGet方法:

String queryProfileStr = ProfileManager.getInstance().getProfile(queryId);if (queryProfileStr != null) {appendCopyButton(response.getContent());appendQueryProfile(response.getContent(), queryProfileStr);getPageFooter(response.getContent());writeResponse(request, response);

这里ProfileManager.getInstance().getProfile(queryId)会获取对应的 Profile.

runtimeProfile数据流

FrontendServiceImpl.reportExecStatus||\/
DefaultCoordinator.updateFragmentExecStatus(params)||\/
QueryRuntimeProfile.updateProfile(execState, params) // 这里会 runtime_profile_report_interval 判断||\/
saveRunningProfile||\/
ProfileManager.pushProfile(profilingPlan, profile);

这里会把 BE端 Fragment 实力的 运行指标都给返回给 FE端.

EXPLAIN ANALYZE

具体语法参考Simulate a query for Profile Analysis Using EXPLAIN ANALYZE
直接转到StarRocks.g4

queryStatement: (explainDesc | optimizerTrace) ? queryRelation outfile?;
...
explainDesc: (DESC | DESCRIBE | EXPLAIN) (LOGICAL | ANALYZE | VERBOSE | COSTS | SCHEDULER)?;
...
optimizerTrace: TRACE (ALL | LOGS | TIMES | VALUES | REASON) identifier?;

通过AstBuilder.visitQueryStatement 解析完后:

@Override
public ParseNode visitQueryStatement(StarRocksParser.QueryStatementContext context) {QueryRelation queryRelation = (QueryRelation) visit(context.queryRelation());QueryStatement queryStatement = new QueryStatement(queryRelation);if (context.outfile() != null) {queryStatement.setOutFileClause((OutFileClause) visit(context.outfile()));}if (context.explainDesc() != null) {queryStatement.setIsExplain(true, getExplainType(context.explainDesc()));}if (context.optimizerTrace() != null) {String module = "base";if (context.optimizerTrace().identifier() != null) {module = ((Identifier) visit(context.optimizerTrace().identifier())).getValue();}queryStatement.setIsTrace(getTraceMode(context.optimizerTrace()), module);}return queryStatement;
}

可以看到queryStatement.setIsExplain(true, getExplainType(context.explainDesc()))这个方法:

  public void setIsExplain(boolean isExplain, ExplainLevel explainLevel) {this.isExplain = isExplain;this.explainLevel = explainLevel;}

会把isExplain设置为true,
之后数据流会转到StmtExecutor.execute方法,最终会调用handleQueryStmt方法:

private void handleQueryStmt(ExecPlan execPlan) throws Exception {// Every time set no send flag and clean all data in buffercontext.getMysqlChannel().reset();boolean isExplainAnalyze = parsedStmt.isExplain()&& StatementBase.ExplainLevel.ANALYZE.equals(parsedStmt.getExplainLevel());boolean isSchedulerExplain = parsedStmt.isExplain()&& StatementBase.ExplainLevel.SCHEDULER.equals(parsedStmt.getExplainLevel());boolean isOutfileQuery = (parsedStmt instanceof QueryStatement) && ((QueryStatement) parsedStmt).hasOutFileClause();if (isOutfileQuery) {Map<TableName, Table> tables = AnalyzerUtils.collectAllTable(parsedStmt);boolean hasTemporaryTable = tables.values().stream().anyMatch(t -> t.isTemporaryTable());if (hasTemporaryTable) {throw new SemanticException("temporary table doesn't support select outfile statement");}}boolean executeInFe = !isExplainAnalyze && !isSchedulerExplain && !isOutfileQuery&& canExecuteInFe(context, execPlan.getPhysicalPlan());if (isExplainAnalyze) {context.getSessionVariable().setEnableProfile(true);context.getSessionVariable().setEnableAsyncProfile(false);context.getSessionVariable().setPipelineProfileLevel(1);} else if (isSchedulerExplain) {// Do nothing.} else if (parsedStmt.isExplain()) {String explainString = buildExplainString(execPlan, ResourceGroupClassifier.QueryType.SELECT,parsedStmt.getExplainLevel());if (executeInFe) {explainString = "EXECUTE IN FE\n" + explainString;}handleExplainStmt(explainString);return;}... StatementBase queryStmt = parsedStmt;List<PlanFragment> fragments = execPlan.getFragments();List<ScanNode> scanNodes = execPlan.getScanNodes();TDescriptorTable descTable = execPlan.getDescTbl().toThrift();List<String> colNames = execPlan.getColNames();List<Expr> outputExprs = execPlan.getOutputExprs();if (executeInFe) {coord = new FeExecuteCoordinator(context, execPlan);} else {coord = getCoordinatorFactory().createQueryScheduler(context, fragments, scanNodes, descTable);}QeProcessorImpl.INSTANCE.registerQuery(context.getExecutionId(),new QeProcessorImpl.QueryInfo(context, originStmt.originStmt, coord));if (isSchedulerExplain) {coord.startSchedulingWithoutDeploy();handleExplainStmt(coord.getSchedulerExplain());return;}coord.exec();coord.setTopProfileSupplier(this::buildTopLevelProfile);coord.setExecPlan(execPlan);

对于 explain analyze 会进行如下配置:

 context.getSessionVariable().setEnableProfile(true);context.getSessionVariable().setEnableAsyncProfile(false);context.getSessionVariable().setPipelineProfileLevel(1);

且会走到 coord.exec();这里会有调度的部分,如以下:

 try (Timer timer = Tracers.watchScope(Tracers.Module.SCHEDULER, "Prepare")) {prepareExec();}try (Timer timer = Tracers.watchScope(Tracers.Module.SCHEDULER, "Deploy")) {deliverExecFragments(needDeploy);}

而在handleQueryStmt下后有finally的处理:

 else if (context.isProfileEnabled()) {isAsync = tryProcessProfileAsync(execPlan, i);if (parsedStmt.isExplain() &&StatementBase.ExplainLevel.ANALYZE.equals(parsedStmt.getExplainLevel())) {if (coord != null && coord.isShortCircuit()) {throw new UserException("short circuit point query doesn't suppot explain analyze stmt, " +"you can set it off by using  set enable_short_circuit=false");}handleExplainStmt(ExplainAnalyzer.analyze(ProfilingExecPlan.buildFrom(execPlan), profile, null));}}

ExplainAnalyzer.analyze这里就是返回的Explain String

ANALYZE PROFILE

直接跳转到Starrocks.g4:

analyzeProfileStatement: ANALYZE PROFILE FROM string| ANALYZE PROFILE FROM string ',' INTEGER_VALUE (',' INTEGER_VALUE)*;

之后到AstBuilder的如下方法:

@Override
public ParseNode visitAnalyzeProfileStatement(StarRocksParser.AnalyzeProfileStatementContext context) {StringLiteral stringLiteral = (StringLiteral) visit(context.string());List<Integer> planNodeIds = Lists.newArrayList();if (context.INTEGER_VALUE() != null) {planNodeIds = context.INTEGER_VALUE().stream().map(ParseTree::getText).map(Integer::parseInt).collect(toList());}return new AnalyzeProfileStmt(stringLiteral.getStringValue(), planNodeIds, createPos(context));
}

之后再到StmtExecutor.handleAnalyzeProfileStmt方法:

private void handleAnalyzeProfileStmt() throws IOException, UserException {AnalyzeProfileStmt analyzeProfileStmt = (AnalyzeProfileStmt) parsedStmt;String queryId = analyzeProfileStmt.getQueryId();List<Integer> planNodeIds = analyzeProfileStmt.getPlanNodeIds();ProfileManager.ProfileElement profileElement = ProfileManager.getInstance().getProfileElement(queryId);Preconditions.checkNotNull(profileElement, "query not exists");// For short circuit query, 'ProfileElement#plan' is nullif (profileElement.plan == null) {throw new UserException("short circuit point query doesn't suppot analyze profile stmt, " +"you can set it off by using  set enable_short_circuit=false");}handleExplainStmt(ExplainAnalyzer.analyze(profileElement.plan,RuntimeProfileParser.parseFrom(CompressionUtils.gzipDecompressString(profileElement.profileContent)),planNodeIds));}

这里通过ProfileManager.getInstance().getProfileElement(queryId)获取到对应的profile,
之后再通过ExplainAnalyzer.analyze获取对应的explain string.

TRACE

具体语法参考query_trace_profile
EXPLAIN ANALYZE的逻辑一样,通过AstBuilder.visitQueryStatement 解析完后,走的是queryStatement.setIsTrace(getTraceMode(context.optimizerTrace()), module);这个逻辑:

 public void setIsTrace(Tracers.Mode mode, String module) {this.isExplain = true;this.traceMode = mode;this.traceModule = module;}

可以看到这里的isExplaintrue.
handleQueryStmt方法为:

} else if (parsedStmt.isExplain()) {String explainString = buildExplainString(execPlan, ResourceGroupClassifier.QueryType.SELECT,parsedStmt.getExplainLevel());if (executeInFe) {explainString = "EXECUTE IN FE\n" + explainString;}handleExplainStmt(explainString);return;
}

这里的buildExplainString方法,会根据tracemode来进行explain String的构建。

其他

  1. 开启Query Profile 指标

| Query:Summary:- Query ID: 135d8852-62fd-11f0-b356-00163e164034- Start Time: 2025-07-17 18:59:13- End Time: 2025-07-17 18:59:14- Total: 268ms- Query Type: Query- Query State: Finished- StarRocks Version: 3.3.5-6d81f75- User: sr_read_write- Default Db- Sql Statement: SELECT `COLUMN_NAME`, `DATA_TYPE`, `ORDINAL_POSITION`, `COLUMN_SIZE`, `DECIMAL_DIGITS`, `IS_NULLABLE`, `COLUMN_KEY`, `COLUMN_COMMENT` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA`='lendtrade' AND `TABLE_NAME`='tr_tran_proc_db_sub';- Variables: parallel_fragment_exec_instance_num=8,max_parallel_scan_instance_num=-1,pipeline_dop=0,enable_adaptive_sink_dop=true,enable_runtime_adaptive_dop=false,runtime_profile_report_interval=10,resource_group=default_wg- NonDefaultSessionVariables: {"sql_mode_v2":{"defaultValue":32,"actualValue":2097184},"big_query_profile_threshold":{"defaultValue":"0s","actualValue":"30s"},"character_set_results":{"defaultValue":"utf8","actualValue":"NULL"},"parallel_fragment_exec_instance_num":{"defaultValue":1,"actualValue":8},"enable_adaptive_sink_dop":{"defaultValue":false,"actualValue":true},"enable_profile":{"defaultValue":false,"actualValue":true}}- Collect Profile Time: 2ms- IsProfileAsync: truePlanner:- -- Parser[1] 0- -- Total[1] 0-     -- Analyzer[1] 0-         -- Lock[1] 0-         -- AnalyzeDatabase[1] 0-         -- AnalyzeTemporaryTable[1] 0-         -- AnalyzeTable[1] 0-     -- Transformer[1] 0-     -- Optimizer[1] 0-         -- MVPreprocess[1] 0-             -- MVChooseCandidates[1] 0-             -- MVGenerateMvPlan[1] 0-             -- MVValidateMv[1] 0-             -- MVProcessWithView[1] 0-         -- MVTextRewrite[1] 0-         -- RuleBaseOptimize[1] 0-         -- CostBaseOptimize[1] 0-         -- PhysicalRewrite[1] 0-         -- PlanValidate[1] 0-             -- InputDependenciesChecker[1] 0-             -- TypeChecker[1] 0-             -- CTEUniqueChecker[1] 0-             -- ColumnReuseChecker[1] 0-     -- ExecPlanBuild[1] 0- -- Pending[1] 0- -- Prepare[1] 0- -- Deploy[1] 23ms-     -- DeployLockInternalTime[1] 23ms-         -- DeploySerializeConcurrencyTime[1] 0-         -- DeployStageByStageTime[3] 0-         -- DeployWaitTime[3] 23ms-             -- DeployAsyncSendTime[1] 0- DeployDataSize: 5803Reason:Execution:- Topology: {"rootId":1,"nodes":[{"id":1,"name":"PROJECT","properties":{"sinkIds":[],"displayMem":false},"children":[0]},{"id":0,"name":"SCHEMA_SCAN","properties":{"displayMem":false},"children":[]}]}- FrontendProfileMergeTime: 732.454us- QueryAllocatedMemoryUsage: 1015.680 KB- QueryCumulativeCpuTime: 11.169ms- QueryCumulativeNetworkTime: 0ns- QueryCumulativeOperatorTime: 240.565ms- QueryCumulativeScanTime: 229.352ms- QueryDeallocatedMemoryUsage: 840.773 KB- QueryExecutionWallTime: 257.617ms- QueryPeakMemoryUsagePerNode: 485.695 KB- QueryPeakScheduleTime: 42.480us- QuerySpillBytes: 0.000 B- QuerySumMemoryUsage: 485.695 KB- ResultDeliverTime: 0nsFragment 0:- BackendAddresses: 172.17.172.252:9060- InstanceIds: 135d8852-62fd-11f0-b356-00163e164035- BackendNum: 1- BackendProfileMergeTime: 541.804us- FragmentInstancePrepareTime: 16.399ms- prepare-fragment-ctx: 922ns- prepare-pipeline-driver: 3.447ms- prepare-pipeline-driver-factory: 8.697ms- prepare-query-ctx: 3.826us- prepare-runtime-state: 4.247ms- InitialProcessDriverCount: 0- InitialProcessMem: 15.307 GB- InstanceAllocatedMemoryUsage: 1015.680 KB- InstanceDeallocatedMemoryUsage: 840.773 KB- InstanceNum: 1- InstancePeakMemoryUsage: 478.039 KB- JITCounter: 0- JITTotalCostTime: 0ns- QueryMemoryLimit: -1.000 BPipeline (id=0):- isGroupExecution: false- ActiveTime: 11.183ms- BlockByInputEmpty: 2- BlockByOutputFull: 0- BlockByPrecondition: 0- DegreeOfParallelism: 1- DriverPrepareTime: 3.445ms- DriverTotalTime: 240.546ms- OverheadTime: 0ns- PeakDriverQueueSize: 0- PendingTime: 229.320ms- InputEmptyTime: 229.323ms- FirstInputEmptyTime: 229.245ms- FollowupInputEmptyTime: 78.368us- OutputFullTime: 0ns- PendingFinishTime: 0ns- PreconditionBlockTime: 0ns- ScheduleCount: 3- ScheduleTime: 42.480us- TotalDegreeOfParallelism: 1- YieldByLocalWait: 0- YieldByPreempt: 0- YieldByTimeLimit: 0RESULT_SINK (plan_node_id=-1):CommonMetrics:- IsFinalSink- CloseTime: 7.404us- OperatorAllocatedMemoryUsage: 19.320 KB- OperatorDeallocatedMemoryUsage: 20.281 KB- OperatorPeakMemoryUsage: 0.000 B- OperatorTotalTime: 5.905ms- PrepareTime: 3.384ms- PullChunkNum: 0- PullRowNum: 0- PullTotalTime: 0ns- PushChunkNum: 1- PushRowNum: 38- PushTotalTime: 5.897ms- SetFinishedTime: 30ns- SetFinishingTime: 60nsUniqueMetrics:result sink:- AppendChunkTime: 5.859ms- ResultRendTime: 33.463us- TupleConvertTime: 5.856ms- NumSentRows: 38CHUNK_ACCUMULATE (plan_node_id=-1):CommonMetrics:- IsSubordinate- CloseTime: 161ns- OperatorTotalTime: 1.133us- PrepareTime: 5.921us- PullChunkNum: 1- PullRowNum: 38- PullTotalTime: 280ns- PushChunkNum: 1- PushRowNum: 38- PushTotalTime: 613ns- SetFinishedTime: 50ns- SetFinishingTime: 29nsUniqueMetrics:PROJECT (plan_node_id=1):CommonMetrics:- CloseTime: 5.650us- OperatorAllocatedMemoryUsage: 1.016 KB- OperatorDeallocatedMemoryUsage: 416.000 B- OperatorPeakMemoryUsage: 640.000 B- OperatorTotalTime: 12.503us- PrepareTime: 7.204us- PullChunkNum: 1- PullRowNum: 38- PullTotalTime: 230ns- PushChunkNum: 1- PushRowNum: 38- PushTotalTime: 6.351us- RuntimeBloomFilterNum: 0- RuntimeInFilterNum: 0- SetFinishedTime: 141ns- SetFinishingTime: 131nsUniqueMetrics:- CommonSubExprComputeTime: 251ns- ExprComputeTime: 2.494usCHUNK_ACCUMULATE (plan_node_id=0):CommonMetrics:- IsSubordinate- CloseTime: 301ns- OperatorTotalTime: 2.636us- PrepareTime: 11.191us- PullChunkNum: 1- PullRowNum: 38- PullTotalTime: 191ns- PushChunkNum: 1- PushRowNum: 38- PushTotalTime: 1.823us- SetFinishedTime: 161ns- SetFinishingTime: 160nsUniqueMetrics:SCHEMA_SCAN (plan_node_id=0):CommonMetrics:- CloseTime: 64.822us- OperatorAllocatedMemoryUsage: 839.242 KB- OperatorDeallocatedMemoryUsage: 552.344 KB- OperatorPeakMemoryUsage: 307.672 KB- OperatorTotalTime: 5.292ms- PrepareTime: 16.070us- PullChunkNum: 1- PullRowNum: 38- PullTotalTime: 5.226ms- PushChunkNum: 0- PushRowNum: 0- PushTotalTime: 0ns- SetFinishedTime: 231ns- SetFinishingTime: 521nsUniqueMetrics:- MorselQueueType: fixed_morsel_queue- ChunkBufferCapacity: 64- DefaultChunkBufferCapacity: 64- FERPC: 211.509ms- FillChunk: 4.506ms- FilterTime: 12.890ms- IOTaskExecTime: 229.309ms- IOTaskWaitTime: 42.740us- MorselsCount: 1- PeakChunkBufferMemoryUsage: 250.513 KB- PeakChunkBufferSize: 1- PeakIOTasks: 1- PeakScanTaskQueueSize: 0- PrepareChunkSourceTime: 5.204ms- ScanTime: 229.352ms- SubmitTaskCount: 2- SubmitTaskTime: 8.015us- TabletCount: 1|
  1. EXPLAIN ANALYZE
+-------------------------------------------------------------------------------------------------------------------------------------+
| Explain String                                                                                                                      |
+-------------------------------------------------------------------------------------------------------------------------------------+
| Summary                                                                                                                     |
|     QueryId: 6b148971-71e6-11f0-8cea-00163e39052a                                                                           |
|     Version: 3.3.5-6d81f75                                                                                                  |
|     State: Finished                                                                                                         |
|     TotalTime: 2s51ms                                                                                                       |
|         ExecutionTime: 0ns [Scan: 0ns (NaN%), Network: 0ns (NaN%), ResultDeliverTime: 0ns (NaN%), ScheduleTime: 0ns (NaN%)] |
|         CollectProfileTime: 2s1ms                                                                                           |
|         FrontendProfileMergeTime: 361.325us                                                                                 |
|     QueryPeakMemoryUsage: ?, QueryAllocatedMemoryUsage: 0.000 B                                                             |
|     Top Most Time-consuming Nodes:                                                                                          |
|         1. RESULT_SINK: 0ns (NaN%)                                                                                          |
|         2. SCHEMA_SCAN (id=0) : 0ns (NaN%)                                                                                  |
|     Top Most Memory-consuming Nodes:                                                                                        |
|     NonDefaultVariables:                                                                                                    |
|         big_query_profile_threshold: 0s -> 30s                                                                              |
|         enable_adaptive_sink_dop: false -> true                                                                             |
|         enable_async_profile: true -> false                                                                                 |
|         enable_profile: false -> true                                                                                       |
|         parallel_fragment_exec_instance_num: 1 -> 8                                                                         |
| Fragment 0                                                                                                                  |
| │   BackendNum: 1                                                                                                           |
| │   InstancePeakMemoryUsage: ?, InstanceAllocatedMemoryUsage: ?                                                             |
| │   PrepareTime: ?                                                                                                          |
| │   MissingInstanceIds: 6b148971-71e6-11f0-8cea-00163e39052b                                                                |
| └──RESULT_SINK                                                                                                              |
|    │   SinkType: MYSQL_PROTOCAL                                                                                             |
|    └──SCHEMA_SCAN (id=0)                                                                                                    |
|           Estimates: [row: 1, cpu: ?, memory: ?, network: ?, cost: 0.0]                                                     |
|           TotalTime: 0ns (NaN%) [CPUTime: ?]                                                                                |
|           OutputRows: ?                                                                                                     |
|                                                                                                                                 |
+-------------------------------------------------------------------------------------------------------------------------------------+
  1. ANALYZE PROFILE 展示的和explain analyze一样,但是指标比 explain analyze 更加丰富
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Explain String                                                                                                                                            |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Summary                                                                                                                                           |
|     QueryId: 135d8852-62fd-11f0-b356-00163e164034                                                                                                 |
|     Version: 3.3.5-6d81f75                                                                                                                        |
|     State: Finished                                                                                                                               |
|     TotalTime: 268ms                                                                                                                              |
|         ExecutionTime: 257.617ms [Scan: 229.352ms (89.03%), Network: 0ns (0.00%), ResultDeliverTime: 0ns (0.00%), ScheduleTime: 42.480us (0.02%)] |
|         CollectProfileTime: 2ms                                                                                                                   |
|         FrontendProfileMergeTime: 732.454us                                                                                                       |
|     QueryPeakMemoryUsage: ?, QueryAllocatedMemoryUsage: 1015.680 KB                                                                               |
|     Top Most Time-consuming Nodes:                                                                                                                |
|         1. SCHEMA_SCAN (id=0) : 234.646ms (97.54%)                                                                                           |
|         2. RESULT_SINK: 5.906ms (2.46%)                                                                                                           |
|         3. PROJECT (id=1) : 12.503us (0.01%)                                                                                                      |
|     Top Most Memory-consuming Nodes:                                                                                                              |
|     NonDefaultVariables:                                                                                                                          |
|         big_query_profile_threshold: 0s -> 30s                                                                                                    |
|         character_set_results: utf8 -> NULL                                                                                                       |
|         enable_adaptive_sink_dop: false -> true                                                                                                   |
|         enable_profile: false -> true                                                                                                             |
|         parallel_fragment_exec_instance_num: 1 -> 8                                                                                               |
|         sql_mode_v2: 32 -> 2097184                                                                                                                |
| Fragment 0                                                                                                                                        |
| │   BackendNum: 1                                                                                                                                 |
| │   InstancePeakMemoryUsage: 478.038 KB, InstanceAllocatedMemoryUsage: 1015.680 KB                                                                |
| │   PrepareTime: 16.399ms                                                                                                                         |
| └──RESULT_SINK                                                                                                                                    |
|    │   TotalTime: 5.906ms (2.46%) [CPUTime: 5.906ms]                                                                                              |
|    │   OutputRows: 38                                                                                                                             |
|    │   SinkType: MYSQL_PROTOCAL                                                                                                                   |
|    └──PROJECT (id=1)                                                                                                                              |
|       │   Estimates: [row: ?, cpu: ?, memory: ?, network: ?, cost: ?]                                                                             |
|       │   TotalTime: 12.503us (0.01%) [CPUTime: 12.503us]                                                                                         |
|       │   OutputRows: 38                                                                                                                          |
|       │   Expression: [4: COLUMN_NAME, 5: ORDINAL_POSITION, 7: IS_NULLABLE, 8: DATA_TYPE, ...]                                                    |
|       └──SCHEMA_SCAN (id=0)                                                                                                                  |
|              Estimates: [row: 1, cpu: ?, memory: ?, network: ?, cost: 0.0]                                                                   |
|              TotalTime: 234.646ms (97.54%) [CPUTime: 5.294ms, ScanTime: 229.352ms]                                                           |
|              OutputRows: 38                                                                                                                  |
|              SubordinateOperators:                                                                                                           |
|                  CHUNK_ACCUMULATE                                                                                                            |
|              Detail Timers: [ScanTime = IOTaskExecTime + IOTaskWaitTime]                                                                     |
|                  FERPC: 211.509ms                                                                                                            |
|                  IOTaskExecTime: 229.309ms                                                                                                   |
|                  IOTaskWaitTime: 42.740us                                                                                                    |
|                                                                                                                                                       |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  1. trace 展示的是某个局部,比如说 某个规则的耗时
MySQL [(none)]> trace times SCHEDULE SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE SCHEMA_NAME = 'fin_config';
+--------------------------------------------------+
| Explain String                                   |
+--------------------------------------------------+
| 0ms|-- Parser[1] 0                               |
| 0ms|-- Total[1] 0                                |
| 0ms|    -- Analyzer[1] 0                         |
| 0ms|        -- Lock[1] 0                         |
| 0ms|        -- AnalyzeDatabase[1] 0              |
| 0ms|        -- AnalyzeTemporaryTable[1] 0        |
| 0ms|        -- AnalyzeTable[1] 0                 |
| 0ms|    -- Transformer[1] 0                      |
| 0ms|    -- Optimizer[1] 0                        |
| 0ms|        -- MVPreprocess[1] 0                 |
| 0ms|            -- MVChooseCandidates[1] 0       |
| 0ms|            -- MVGenerateMvPlan[1] 0         |
| 0ms|            -- MVValidateMv[1] 0             |
| 0ms|            -- MVProcessWithView[1] 0        |
| 0ms|        -- MVTextRewrite[1] 0                |
| 0ms|        -- RuleBaseOptimize[1] 0             |
| 0ms|        -- CostBaseOptimize[1] 0             |
| 1ms|        -- PhysicalRewrite[1] 0              |
| 1ms|        -- PlanValidate[1] 0                 |
| 1ms|            -- InputDependenciesChecker[1] 0 |
| 1ms|            -- TypeChecker[1] 0              |
| 1ms|            -- CTEUniqueChecker[1] 0         |
| 1ms|            -- ColumnReuseChecker[1] 0       |
| 1ms|    -- ExecPlanBuild[1] 0                    |
| Tracer Cost: 9us                                 |
+--------------------------------------------------+MySQL [(none)]> trace times OPTIMIZER SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE SCHEMA_NAME = 'fin_config';
+----------------------------------------------------------+
| Explain String                                           |
+----------------------------------------------------------+
| 0ms|-- Parser[1] 0                                       |
| 0ms|-- Total[1] 0                                        |
| 0ms|    -- Analyzer[1] 0                                 |
| 0ms|        -- Lock[1] 0                                 |
| 0ms|        -- AnalyzeDatabase[1] 0                      |
| 0ms|        -- AnalyzeTemporaryTable[1] 0                |
| 0ms|        -- AnalyzeTable[1] 0                         |
| 0ms|    -- Transformer[1] 0                              |
| 0ms|    -- Optimizer[1] 0                                |
| 0ms|        -- MVPreprocess[1] 0                         |
| 0ms|            -- MVChooseCandidates[1] 0               |
| 0ms|            -- MVGenerateMvPlan[1] 0                 |
| 0ms|            -- MVValidateMv[1] 0                     |
| 0ms|            -- MVProcessWithView[1] 0                |
| 0ms|        -- MVTextRewrite[1] 0                        |
| 0ms|        -- RuleBaseOptimize[1] 0                     |
| 0ms|            -- RewriteTreeTask[59] 0                 |
| 0ms|                -- PushDownPredicateProjectRule[1] 0 |
| 0ms|                -- PushDownPredicateScanRule[1] 0    |
| 0ms|                -- MergeTwoProjectRule[2] 0          |
| 0ms|                -- PruneProjectColumnsRule[2] 0      |
| 0ms|                -- PruneScanColumnRule[2] 0          |
| 0ms|                -- PruneSubfieldRule[1] 0            |
| 0ms|                -- PruneProjectRule[2] 0             |
| 0ms|                -- MergeProjectWithChildRule[1] 0    |
| 0ms|        -- CostBaseOptimize[1] 0                     |
| 0ms|            -- OptimizeGroupTask[1] 0                |
| 0ms|            -- OptimizeExpressionTask[1] 0           |
| 0ms|            -- DeriveStatsTask[1] 0                  |
| 0ms|            -- ApplyRuleTask[1] 0                    |
| 0ms|                -- SchemaScanImplementationRule[1] 0 |
| 0ms|            -- EnforceAndCostTask[1] 0               |
| 0ms|        -- PhysicalRewrite[1] 0                      |
| 1ms|        -- PlanValidate[1] 0                         |
| 1ms|            -- InputDependenciesChecker[1] 0         |
| 1ms|            -- TypeChecker[1] 0                      |
| 1ms|            -- CTEUniqueChecker[1] 0                 |
| 1ms|            -- ColumnReuseChecker[1] 0               |
| 1ms|    -- ExecPlanBuild[1] 0                            |
| Tracer Cost: 21us                                        |
+----------------------------------------------------------+其中这里面的[1] 数字代码该规则被应用的次数,如 PhysicalRewrite[1]则表示 改规则被应用了1次。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/pingmian/91994.shtml
繁体地址,请注明出处:http://hk.pswp.cn/pingmian/91994.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网络 —— 笔记本(主机)、主机虚拟机(Windows、Ubuntu)、手机(笔记本热点),三者进行相互ping通

背景介绍最近在笔记本电脑上的虚拟机(Ubuntu、Windows Server搭配)上部署了"WD"开源手游服务器(旧版本)&#xff0c;手机连接上了笔记本电脑开启的WIFI热点&#xff0c;同时手机上安装了"WD"手游客户端。于是首先得保证网络相互畅通才能玩游戏&#xff0c;…

裸露土堆识别准确率↑32%:陌讯多模态融合算法在生态监测的实战解析

原创声明本文为原创技术解析文章&#xff0c;涉及技术参数及架构描述均参考《陌讯技术白皮书》&#xff0c;禁止任何形式的转载与抄袭。一、行业痛点&#xff1a;裸露土堆识别的现实挑战在生态环境保护、建筑工地监管等场景中&#xff0c;裸露土堆的精准识别是遏制扬尘污染、防…

网站从HTTP升级到HTTPS网址方法

将网站从HTTP升级到HTTPS涉及几个关键步骤&#xff0c;以确保安全连接以及用户和搜索引擎的平稳过渡。获取并安装SSL/TLS证书&#xff1a;1、从CA机构授权提供商Gworg获取SSL/TLS证书。选项包括域名验证(DV)、组织验证(OV)和扩展验证(EV)证书&#xff0c;验证严格度各不相同&am…

WaitForSingleObject 函数参数影响及信号处理分析

一、第二个参数&#xff08;超时时间&#xff09;的影响 DWORD result WaitForSingleObject(hHandle, 1000);中的第二个参数1000表示等待超时时间为1000毫秒&#xff08;1秒&#xff09;&#xff0c;其核心影响如下&#xff1a; 1. 函数行为控制 立即返回&#xff1a;若对象已…

dbeaver导入数据及配置讲解

导入数据教程&#xff1a; 前提.csv文件&#xff1a;且只能导入一个sheet点击下一步选中导入的.csv文件对应好数据字段和表字段&#xff0c;感觉不需要导入的可以skip配置一下&#xff0c;下面有介绍&#xff1a;以下为你详细解析这些数据加载相关功能的含义与作用&#xff1a;…

JAVA学习笔记 自增与自减的使用-006

目录 1 基本概述 2 自增与自减的用法 2.1单独使用 2.2 参与运算 3 思考与练习 3.1 基础题 3.2 中等题 3.3 进阶题 4 总结 源计划&#xff1a;我从来不认为自己的成功过程有多心酸&#xff0c;只是心中不惧失败&#xff0c;能够承受别人不能接受的失望而已&#xff01;…

从LCM到SomeIP,再到DDS:技术演进与工作原理剖析

文章目录一、LCM&#xff1a;轻量级通信与编组库工作原理C 代码示例局限性二、SomeIP&#xff1a;面向服务的可扩展中间件工作原理C 代码示例优势与特点三、DDS&#xff1a;数据分发服务工作原理C 代码示例优势与应用场景四、技术演进总结在分布式系统通信领域&#xff0c;技术…

Redis里面什么是sdshdr,可以详细介绍一下吗?

文章目录为什么 Redis 不直接使用 C 语言的字符串&#xff1f;sdshdr 的结构sdshdr 的不同类型sdshdr 带来的优势总结我们来详细解析一下 Redis 的核心数据结构之一&#xff1a; sdshdr。sdshdr 是 “Simple Dynamic String header” 的缩写&#xff0c;意为“简单动态字符串头…

RocketMq如何保证消息的顺序性

文章目录1.顺序消息的全流程1.1 发送阶段&#xff1a;消息分区1.2.存储阶段&#xff1a;顺序写入1.3.消费阶段&#xff1a;串行消费2.第三把锁有什么用?3.顺序消费存在的问题和Kafka只支持同一个Partition内消息的顺序性一样&#xff0c;RocketMQ中也提供了基于队列(分区)的顺…

zabbix平台无法删除已停用主机的处理案例

在zabbix平台上删除已停用的主机&#xff0c;提示“SQL描述式执行已失败: "DELETE FROM items WHERE (itemid IN &#xff08;.....)”&#xff0c;无法删除&#xff0c;本文为处理情况。一、问题现象在zabbix平台上删除已停用的主机&#xff0c;提示“SQL描述式执行已失败…

【计算机网络】6应用层

1.网络应用模型 特性 客户/服务器模型(Client-Server, C/S) 对等模型(Peer-to-Peer, P2P) 中心化 是(依赖服务器) 否(去中心化) 角色特点 服务器 客户机 无中心服务器 提供计算服务 请求计算服务 每个节点(Peer)既是客户机也是服务器 永久在线 间歇接入网络 节点间…

基于 Spring Boot + Vue 实现人脸采集功能全流程

一、技术栈与依赖引入 后端依赖 (pom.xml) <!-- 百度AI SDK --> <dependency><groupId>com.baidu.aip</groupId><artifactId>java-sdk</artifactId><version>4.16.19</version><exclusions><exclusion><grou…

《Python基础》第3期:使用PyCharm编写Hello World

我们写文档大多用 Word、写表格大多用 Excel、写幻灯片大多用 PPT。 写代码也需要一个软件作为编辑器&#xff08;传说的大神用记事本写代码纯属玩笑了&#xff0c;越是大神越追求效率&#xff0c;用的软件功能越强&#xff09;。 Python 现在已经有了非常多的代码编辑器&#…

我的第一个开源项目:排序算法的多种实现方式

以 排序算法 为例&#xff0c;展示如何在 Python 中进行不同实现方式的对比项目概述本项目旨在通过 Python 实现几种经典的排序算法&#xff0c;并通过性能对比、代码注释和优化手段&#xff0c;为开源社区提供参考。选择排序、冒泡排序、快速排序和归并排序作为主要算法&#…

5G-LEO - 用于 5g satellite 链接的 OpenAirInterface™ 扩展

目标&#xff1a;5G-LEO 旨在加速 OAI 作为开源工具的发展&#xff0c;允许卫星通信社区交流和比较 5G NTN 结果&#xff0c;并促进研发活动的合作。扩展的OAI软件库被视为开发早期原型的重要工具&#xff0c;用于验证关键的5G NTN设计方面&#xff0c;并为3GPP标准化过程提供及…

基于 Mybatis 框架*的完整开发流程与顺序

基于 MyBatis 框架 的完整开发流程与顺序一、环境准备阶段1. 新建 Maven 项目&#xff08;或普通 Java 项目&#xff09;作用&#xff1a;用 Maven 统一管理依赖&#xff0c;自动下载 MyBatis、MySQL 驱动等 Jar 包操作&#xff1a;IDE&#xff08;如 IDEA&#xff09;选 Maven…

机械学习--决策树(实战案例)

决策树分两种分类和回归&#xff0c;这篇博客我将对两种方法进行实战讲解一、分类决策树代码的核心任务是预测 “电信客户流失状态”&#xff0c;这是一个典型的分类任务数据集附在该博客上&#xff0c;可以直接下载代码整体结构整理代码主要分为以下几个部分&#xff1a;导入必…

SQL154 插入记录(一)

描述牛客后台会记录每个用户的试卷作答记录到exam_record表&#xff0c;现在有两个用户的作答记录详情如下&#xff1a;用户1001在2021年9月1日晚上10点11分12秒开始作答试卷9001&#xff0c;并在50分钟后提交&#xff0c;得了90分&#xff1b;用户1002在2021年9月4日上午7点1分…

BeanFactory 和 ApplicationContext 的区别?

口语化答案好的&#xff0c;面试官。BeanFactory和ApplicationContext都是用于管理Bean的容器接口。BeanFactory功能相对简单。提供了Bean的创建、获取和管理功能。默认采用延迟初始化&#xff0c;只有在第一次访问Bean时才会创建该Bean。因为功能较为基础&#xff0c;BeanFact…

VNC连接VirtualBox中的Ubuntu24.04 desktop图形化(GUI)界面

测试环境&#xff1a;VirtualBox 7,Ubuntu24.04 desktop,Ubuntu24.04 server(no desktop) 一、下载和安装dRealVNC viewer。 二、配置 VirtualBox 网络&#xff1a;NAT 模式 端口转发 1、打开 VirtualBox&#xff0c;选择您的 Ubuntu 虚拟机&#xff0c;点击 设置。 选择 网…