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
英文地址,請注明出處:http://en.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;點擊 設置。 選擇 網…